PDA

View Full Version : C/C++ programing help!



minaadel1994
05-02-2008, 08:46 AM
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 :)

SyntaXmasteR
05-06-2008, 11:56 AM
I just ******* over the code and it appears you forgot a "(" in one of your functions.



int sub x, int y)


should be



int sub(x, int y)


after reading more of your code looks like it should be



int sub(int x, int y)