hello, i am a basic person so i created a basic program
it says some error that doesnt any sense.....I posted it
if you can spare the time to overveiw my code i would reallt appretiate it
---------------------------------------------------------------------------
This program askes u if u want to divide multiply add subtract square numbers... i tryed to put in a loop but thats what got everything messed up
---------------------------------------------------------------------------
fatal error C1004: unexpected end of file found
---------------------------------------------------------------------------
Code:
/*********************************************
**********************************************
**********************************************
*************** Brett Charles ****************
************ [email protected] ***********
********* Cprograming.com membership: ********
****************** Prodigy *******************
**********************************************
**********************************************
**********************************************/
#include <iostream.h>
#include <stdlib.h>
int main ()
{
char c;
int x,y,z;
bool active = true;
char response;
while(active)
{
cout << " -------" << endl;
cout << " Welcome" << endl;
cout << " -------" << endl;
cout << "Push q if u would like to square, d to divide, s to subtract, a to add, and m to multiply"<< endl;
cin >> c;
if((c == 'q')||(c == 'Q'))
{
cout << " ------" ;
cout << "\n Square";
cout << "\n ------";
cout << "\nEnter a number: ";
cin >> x;
y = x * x;
cout << x << " squared = "<< y << endl;
}
if ((c == 'd')||(c == 'D'))
{
cout << " ------";
cout << "\n Divide";
cout << "\n ------";
cout << "\nEnter a dividend: ";
cin >> x;
cout << "\nType in a divisor: ";
cin >> y;
z = x/y;
cout << x << " / " << y << " = " << z << endl;
if (x == y)
cout << "\aError cannot divide by zero!!!" << endl;
}
if ((c == 's')||(c == 'S'))
{
cout << " --------";
cout << "\n Subtract";
cout << "\n --------";
cout << "\nType in a number: ";
cin >> x;
cout << "\nType in anoher number: ";
cin >> y;
z = x - y;
cout << x << " - " << y << " = " << z << endl;
}
if ((c == 'a')||(c == 'A'))
{
cout << " ---";
cout << "\n Add";
cout << "\n ---";
cout << "Type in a number: ";
cin >> x;
cout << "Type in another number: ";
cin >> y;
z = x + y;
cout << x << " + " << y << " = " << z << endl;
}
if ((c == 'm')||(c == 'M'))
{
cout << " --------";
cout << "\n Multiply";
cout << "\n --------";
cout << "Type in a number: ";
cin >> x;
cout << "Type in another number: ";
cin >> y;
z = x * y;
cout << x << " * " << y << " = " << z << endl;
}
cout<<endl<<"Again? Y / N"<<endl;
cin>>response;
switch(response)
{
case 'y':
{
}break;
case 'Y':
{
}break;
case 'n':
{
active = false;
}break;
case 'N':
{
active = false;
}break;
return 0;
}
//right here it says the error is
// fatal error C1004: unexpected end of file found
// I DONT KNOW WHATS WRONG!!!!!!!!!!!!!!!!!!