View Single Post
Old May 4th, 2008, 9:30 AM   #1
Arnack
Programmer
 
Join Date: Jul 2005
Posts: 66
Rep Power: 4 Arnack is on a distinguished road
Simple if statement question :(

I haven't used C++ in a while, and right when I get back to starting up again, I fall upon this simple error in my simple code here:
C++ Syntax (Toggle Plain Text)
  1. #include <iostream.h>
  2. #include <stdio.h>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main(void)
  7. {
  8. int number1;
  9. int number2;
  10. int number3;
  11. int number4;
  12. int sum;
  13. string relay;
  14.  
  15. cout<<"I'm going to add these numbers you give me. First Number: ";
  16. cin>>number1;
  17. cout<<"next number: ";
  18. cin>>number2;
  19. cout<<"and the next number: ";
  20. cin>>number3;
  21. cout<<"and the last number: ";
  22. cin>>number4;
  23. sum=(number1+number2+number3+number4);
  24.  
  25. {
  26. if(sum < 10){
  27. relay = "small.";
  28. }
  29. if (sum > 10) && (sum >50)
  30. {
  31. relay = "big.";
  32. }
  33.  
  34.  
  35. cout<<"Your number is " << relay << "\n";
  36.  
  37.  
  38. system("PAUSE");
It comes out with errors such as: expected
`;' before '(' token
expected identifier before '(' token

Any help, please?
__________________
Ack Network
*UNDER CONSTRUCTION*
Now hiring staff of all sorts.
Arnack is offline   Reply With Quote