ok, after almost finishing my first usable program. I started to debug and i got a couple of errors which i cant fix. This is my code and the errors are at the bottom. Thanx ;)
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<iostream.h>
using namespace std;
int main() {
char loop = 'y';
char operand;
float f1;
float f2;
float f3;
system("TITLE Calculator V2.01");
system("COLOR 2");
do while(loop == 'y' || loop == 'Y')
{
system("CLS");
cout <<" Welcome to Calculator Program V2" << endl;
cout << " Please type in your first integer or decimal: ";
cin >> f1;
cout << " Now select a operation you wish to complete(-,+,*, or /): ";
cin >> operand;
cout << " Finally, type in your last integer or decimal: ";
cin >> f2;
cout << endl << endl;
switch(operand)
{
case '+' :
f3 == f1 + f2;
cout << "The answer is " << f3 << endl;
cout << f1 << "+" << f2 << "=" << f3 << endl;
break;
case '-' :
f3 == f1 - f2;
cout << "The answer is " << f3 << endl;
cout << f1 << "-" << f2 << "=" << f3 << endl;
break;
case '*' :
f3 == f1 * f2;
cout << "The answer is " << f3 << endl;
cout << f1 << "*" << f2 << "=" << f3 << endl;
break;
case '/' :
if( f2 == 0){
cout << "That is a invalid operation" << endl;
}
else{
f3 == f1 / f2;
cout << "The answer is " << f3 << endl;
cout << f1 << "/" << f2 << "=" << f3 << endl;
}
break;
default :
cout << "That is a invalid operation" << endl;
break;
}
cout << "Would you like to start again? [y/n]: ";
cin >> loop;
system("PAUSE");
return 0;
}
|
32:2 C:\Dev-Cpp\include\c++\3.4.2\backward\backward_warning.h #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated. 32:2
62 C:\Documents and Settings\user\My Documents\calculator.cpp expected `while' at end of input
62 C:\Documents and Settings\user\My Documents\calculator.cpp expected `(' at end of input
62 C:\Documents and Settings\user\My Documents\calculator.cpp expected primary-expression at end of input
62 C:\Documents and Settings\user\My Documents\calculator.cpp expected `)' at end of input
62 C:\Documents and Settings\user\My Documents\calculator.cpp expected `;' at end of input
62 C:\Documents and Settings\user\My Documents\calculator.cpp expected `}' at end of input
THNAKX AGAIN xd