C/C++ :: Program That Will Display Morse Code
Apr 28, 2015
IM trying to make a simple program that will display morse code. Ex if you type 0 print should be (-----) and all the way up to 5. The problem is though that all printf displays all the numbers and not executing only the assigned variable.
#include<stdio.h>
int main(void) {
int a , b , c , d , e, f, x;
a = 0;
b = 1;
c = 2;
d = 3;
e = 4;
f = 5;
x = 6;
[Code] ....
View 4 Replies
ADVERTISEMENT
Mar 2, 2013
Code:
#include <iostream>
#include <windows.h>
#include <iomanip>
using namespace std;
[Code] .....
I'm trying to implement Morse code program. However, I cannot find any codes which make a time gap between the letters. How the time gap code?
View 4 Replies
View Related
Dec 8, 2014
I need to covert English to Morse code and vise versa. I found English to Morse however I cant figure out Morse Code to English. When it runs it read the first character of Morse Code but not the rest so .- would be outputted as ab.
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <cctype>
#include <string>
using namespace std;
string texttomorse(char l) {
[Code] ....
View 7 Replies
View Related
Feb 20, 2015
get my code to display a table with values from a file. my current code fills up all the sections of the table with the same data. here is what I need: from a file .txt I upload numbers that should show a table like this :
Lake Beach Average E-Coli Level
Recommendation
Ontario Kew Beach 47.12 OPEN Huron Goderich 51.13 CLOSED Simcoe Sibbald Point 0 INSUFFICIENT
my problem is in the last two columns. The ave. E-coli has one value for all which should look like the above table but my code doesn't. Also my recommendation shows the beach # instead of open close or insufficient.the data is:
Lake table
1: Ontario
2: Erie
3: Huron
4: Muskoka
5: Simcoe
Beach table
100: Kew Beach
101: Sunnyside Beach
103: Sandbanks
201: Port Dover
202: Port Burwell
203: Crystal Beach
301: Goderich
302: Sauble Beach
303: Kincardine
401: Muskoka Beach
501: Sibbald Point
the .txt file contains the following data:
1 101 5 66.6 33.3 22.2 98.9 11.1
5 501 2 33.3 44.3
now this is my code:
Code:
#include <stdio.h>
#include <math.h>
int main(void)
{
FILE *in;
}
[code]......
fix the two last columns so the correct info shows like the table above.
View 3 Replies
View Related
Sep 7, 2013
I've been wondering how some program using codes is animated?
View 3 Replies
View Related
Jun 21, 2014
C++: write a c++ program that will display your name, address and age..
View 3 Replies
View Related
Jan 23, 2014
i wrote this program to display even number from 100-200. But visual c gives me this error with undeling the "a" in if statement. Error1error C2106: '=' : left operand must be l-value
#include<iostream>
#include<conio.h>
using namespace std;
void main(){
for(int a=100;a<200;a++){
if(a%2=0)
cout<<a<<endl;
}
_getch();
}
View 1 Replies
View Related
Aug 24, 2013
Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <SDL/SDL.h>
[Code]....
I don't know why since I've assigned a value like that to a variable of that same type before. Unless I had garbage data somewhere and didn't realize it.
View 9 Replies
View Related
Apr 24, 2013
//code
ofstream outFile;
outFile.open("p4a.dat");
outFile << setw(8) << "90.0";
outFile << setw(8) << "75.0";
outFile << setw(8) << "36" << endl;
[Code] .....
View 1 Replies
View Related
Apr 23, 2013
who can provide a souce code for autopilot helicopter. because i'm doing a project.
View 4 Replies
View Related
Feb 8, 2014
I have to write a program to display multiplication tables. I have written the following code:
Code:
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
[Code] ....
View 2 Replies
View Related
Feb 21, 2013
Write a program that displays n depth * pyramid.
For example,Input: 4
Output:
*
***
*****
*******
This is what i have so far but it not giving me what i want.
#include <iostream>
using namespace std;
int main() {
int star;
int count=1;
cout<<"Enter the number: ";
cin>>star;
[Code] ....
View 1 Replies
View Related
Oct 4, 2014
This is a program that display prime numbers from 1 to 100. it has problem linking when i run the program.
#include <iostream>
class Prime {
public:
int PrimeNo();
int Display();
};
// class Prime number
int Prime::PrimeNo()
[Code] ....
View 3 Replies
View Related
Feb 25, 2014
Write a program that displays the first 40 Fibonacci numbers. A Fibonacci number is created by add the previous two, with the first two always being 0 and 1. A partial sequence is as follows:
0, 1, 1, 2, 3, 5, 8, 13, 21,….
Your table must display 6 numbers per row and use a spacing of 10 for each number. Don’t forget to include the header file “iomanip” at the top and use “setw()”. You will need to turn in an algorithm, source code and output.
Here is what i have but i get errors!
#include <iostream>
using namespace std; {
int FirstNumber = 0;
int SecondNumber = 1;
int NumberOfNumbers = 2;
int NewNumber;
[Code] .....
View 3 Replies
View Related
Feb 14, 2013
I'm trying to display the AM/PM on my program:
Also is there a way to display the time only instead of the date? How will i change the program to display the time in standard 12 hours, instead of 24 hours?
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
time_t tim;
time(&tim);
cout << ctime(&tim);
}
View 1 Replies
View Related
Mar 18, 2013
Write a program that asks the user to enter the number of calories and fat grams in a food item. The program should display the percentage of the calories that come from fat. One gram of fat has 9 calories, so:
(Calories from fat) = (fat grams) * 9
The percentage of calories from fat can be calculated as:
(Calories from fat) / (total calories)
Extend as follow
1. The user first enters from a menu whether it is breakfast (B or b), lunch (L or l) or dinner (D or d). Use character and process by a switch.
2. The threshold for low calorie is different, for breakfast 10%, lunch 20%, dinner 30% (this value has to be assigned to some threshold variable in the above switch).
3. Include validation of menu choice.
4. In case any validation fails, display detailed error and exit the program by calling return 1 or return EXIT_FAILURE
5. Display the % from fat with one decimal digit.
Example 1:
What you have to eat:
B - breakfast
L - lunch
D - dinner
What you have: C
Error: C is not a valid menu choice
Example 2:
What you have to eat:
B - breakfast
L - lunch
D - dinner
What you have: L
How many calories: 600
How many grams of fat: 10
Your food has 15.0% calories from fat
It is a low calories food
Process the menu in a switch, setting the threshold as either 10, 20, or 30%. The rest of the program will be the same regardless what was the menu choice.
Incremental development: first do the textbook problem without input validation, then extend with validation, then extend for the additional parts.
View 4 Replies
View Related
Jun 10, 2013
How to make a source code into a functional program that a user can open and use without coming across the source code and building or running it.
View 1 Replies
View Related
Jun 9, 2013
I have a Third Party MS-DOS program, RUN.EXE
RUN.EXE do the following:
1. Read FILE.INP as input file and run its code execution.
2. When finish, RUN.EXE will produce FILE.OUT as the output of its code execution.
3. However, if calculation made in the code execution come to unsatisfied condition, RUN.EXE will terminate without producing FILE.OUT or partially produce FILE.OUT.
I want to write a program using MFC which I can set a several input case. The program should be able to:
1. Call RUN.EXE.
2. Wait for RUN.EXE to exit.
3. Continue with other code.
I can't modified RUN.EXE. I can't have RUN.EXE callback my program to let know it finish its work.
Are there any functions to call RUN.EXE, a MS-DOS program? Are there any way for the program to check if RUN.EXE finish its work and exited?
View 4 Replies
View Related
Mar 23, 2014
I decided to create a simple program to display a menu with options, while that is easy enough I had some difficulty when selecting an option that has options inside which also has an option again. While I had many issues in the past I'm finally finished with it and it works fine, but being new to programming and not knowing various other methods available.
Code:
//:::::::::::::::::::::Simple Menu Program::::::::::::::::
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#include <iostream>
#include <string>
//function prototypes
[Code] .....
View 1 Replies
View Related
Dec 28, 2013
Constructing this right aligned half pyramid? The code I had so far is right aligned and they're not in numbers
Write a program that receives one positive integer and display
_________ _ 1
________ 4 2
_______9 6 3
___16 12 8 4
25 20 15 10 5
when the user key in 5.PS: ignore the line
View 3 Replies
View Related
Nov 4, 2013
SO Im supposed to write a program that uses arrays to calculate the sum and display it. I keep getting the error that says the sum has to be initialized.
#include <iostream>
using namespace std;
//Function prototype
int sumArray(int);
const int NUM_ELEMENTS = 5;
[Code] .....
View 1 Replies
View Related
Dec 9, 2013
How do i display the output ? This program only saves the output to "gpa.txt" I want it to also display the output to cmd.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <string>
using namespace std;
const int SIZE = 10;
[Code] ....
View 1 Replies
View Related
Oct 13, 2013
I would like my program to display other functions in the int main function. For example, this is what my program looks like:
int Function1(int &var1, int &var2, int &var3) {
cout << "blah blah blah" ;
cin >> var1 ;
var2 = var1 * 3 ; //example
var3 = var1 * var2 ; //example
if(blah blah blah)
[Code]...
View 2 Replies
View Related
May 16, 2014
The code is supposed to display the total and averages of the data as well, but cuts off due to an error in the code. The code should also:
1)Print checks for all employees, one per page, sorted by lastname. The first check number, 100, is to be read from a company data file (see requirement 4). The border of each check is important and should not be omitted.
2)Convert the net pay to a text string for each check printed.
3)Print a reference code on each check. The reference code is obtained by combining the first letter of the lastname with all the consonants remaining after removing all vowels (a,e,i,o,u).
4)Use the same employee data found in assignment 2. Use company data, obtained from a text file, for each check printed:
Spoiler
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
typedef short BOOLEAN;
typedef char STR15[15 + 1];
typedef char STR10[10 + 1];
typedef struct PayRecord
[Code] .....
View 14 Replies
View Related
Feb 3, 2015
i need the output to display the product of every whole number from 1-3 in a table format.
this is the code i have so far. i know some brackets are missing but i just pasted the meat of the code. when i run the program i keep getting the number 1 displayed in a straight line going on forever
int multiply1 = 1;
int multiply2 = 1;
while(num1<=3)
{ // num1*num2;
//num1 = 0;
while(num2<=3)
{ Console.WriteLine(multiply1*multiply2);
if(num1>=3)
{ Console.Write();
}
}
num1++;
}
View 2 Replies
View Related
Nov 1, 2013
I am a beginner and I ALWAYS have the toughest time doing I/O files. It's extremely frustrating. It "seems" it should be so simple. The program should find a code from a list of numbers. These numbers are from 0 - 9, and after each number is a space in the file. Your job is to extract a special code containing only 10 of those numbers. For the number to be part of the code, it should be divisible by 2. After extracting 10 numbers divisible by 2 for the code, write those 10 numbers to the file to form the expected code.
Input file is ("question.txt")
Output should be ("code.txt")
Should this contain a "for loop" or If/else ?
Here's what I did . .
/
// int numbers, total, counter;
ifstream inFile;
inFile.open ("question.txt");
outFile.open ("code.txt");
if (!inFile)
[Code] ....
View 2 Replies
View Related