Hey guys,
Just starting to learn C++ language. Hope you guys can help me a way or other since every forum I have joined has been a huge help with me. :)
I have an assignment that would like to develop a C++ program that would perform a selection structure. The assignment is to present a user with a menu that would convert Celsius into Fahrenheit and back, and Pounds to Kilos, and back.
This is what I got.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#include <cmath>
#include <iostream>
using namespace std;
int main(void)
{
double Celsius;
double Fahrenheit;
double Pounds;
double Kilograms;
float B;
int A;
cout << "Pick the number of the program you would like to use" << endl;
cout << "1.) Program Converting from Celsius to Fahrenheit" << endl;
cout << "2.) Program Converting from Fahrenheit to Celsius" << endl;
cout << "3.) Program Converting from Pounds to Kilograms" << endl;
cout << "4.) Program Converting from Kilograms to Pounds" << endl;
cin >> B;
{
do
cout << "Welcome to the Program Converting from Celsius to Fahrenheit" << endl;
cout << "Input the Degrees (in Celius) and press Enter" << endl;
cin >> Celsius;
Fahrenheit = (Celsius(9.0/5.0)) + 32;
cout << " Degrees Fahrenheit = " << Fahrenheit << endl;
cin >> B;
while (A == 1);
}
{
do
cout << "Welcome to the Program Converting from Fahrenheit to Celsius" << endl;
cout << "Input the Degrees (in Fahrenheit) and press ENTER:" << endl;
cin >> Fahrenheit
Celsius = (Fahrenheit - 32) * (5.0/9);
cout << "Degrees Celsius = " << Celsius << endl;
while (A == 2);
}
{
do
cout << "Welcome to the Program Converting from Pounds to Kilograms" << endl;
cout << "Input the Pounds (lbs) and Press Enter" << endl;
cin >> B;
Kilograms = 2.2 * (Pounds);
cout << "Kilograms = " << Kilograms << endl;
while (A == 3);
}
{
do
cout << "Please enter the weight in Kilograms (kg) and press Enter" << endl;
cin >> Kilograms;
Pounds = Kilograms * (1/2.2);
cout << "Pounds = " << Pounds << endl;
while (N == 4);
}
system ("pause");
}
|
These are the errors:
1>c:\users\ce sharp\documents\visual studio 2010\projects\lab3\lab3\lab3.cpp(27): error C2061: syntax error : identifier 'cout'
1>c:\users\ce sharp\documents\visual studio 2010\projects\lab3\lab3\lab3.cpp(29): error C2064: term does not evaluate to a function taking 1 arguments
1>c:\users\ce sharp\documents\visual studio 2010\projects\lab3\lab3\lab3.cpp(38): error C2061: syntax error : identifier 'cout'
1>c:\users\ce sharp\documents\visual studio 2010\projects\lab3\lab3\lab3.cpp(40): error C2146: syntax error : missing ';' before identifier 'Celsius'
1>c:\users\ce sharp\documents\visual studio 2010\projects\lab3\lab3\lab3.cpp(48): error C2061: syntax error : identifier 'cout'
1>c:\users\ce sharp\documents\visual studio 2010\projects\lab3\lab3\lab3.cpp(57): error C2061: syntax error : identifier 'cin'
1>c:\users\ce sharp\documents\visual studio 2010\projects\lab3\lab3\lab3.cpp(60): error C2065: 'N' : undeclared identifier
1>c:\users\ce sharp\documents\visual studio 2010\projects\lab3\lab3\lab3.cpp(60): fatal error C1903: unable to recover from previous error(s); stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Please help.