-
C/C++ programing help!
hi im a newbie! and im learning C++/C but i got difficulties i wanna make a calculator! and in the same time i want the program to open in windows mode not in cmd (command prompt ) u know the black screen thing! with white text..... i already html/dhtml i must say i know whats in all the tutorials but i don't think they r complete here is the code i need help in :
#include <iostream>
using namespace std;
int mult (int x , int y);
int main()
{
int x;
int y;
cout<<"put the number here: ";
cin>>x>>y;
cin.ignore();
cout<<"equals: "<<mult (x,y);
cin.get();
}
int mult (int x, int y)
{
return x * y;
}
ok this works but when i add this:
#include <iostream>
using namespace std;
int mult (int x , int y);
int main()
{
int x;
int y;
cout<<"put the number here: ";
cin>>x>>y;
cin.ignore();
cout<<"equals: "<<mult (x,y);
cin.get();
}
int mult (int x, int y)
{
return x * y;
}
{
int x;
int y;
cout<<"put the number here: ";
cin>>x>>y;
cin.ignore();
cout<<"equals: "<<sub,y);
cin.get();
}
int sub x, int y)
{
return x - y;
}
the error is:expected unqualified id before ' { ' token
what should i do any advices? any help or advice wud be good :)
-
I just ******* over the code and it appears you forgot a "(" in one of your functions.
[code]
int sub x, int y)
[/code]
should be
[code]
int sub(x, int y)
[/code]
after reading more of your code looks like it should be
[code]
int sub(int x, int y)
[/code]