Debug error.

This is a discussion on Debug error. within the C++ Programming forums, part of the General Programming Boards category; For some reason the following code gives me a debug error. As far as I can see I typed it ...

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    62

    Debug error.

    For some reason the following code gives me a debug error. As far as I can see I typed it over with no mistakes from the book.

    Please do not give me any other options of coding this piece. I would just like to know what the error refers to.
    Code:
    #include <iostream>
    
    int main()
    {
     // ask for two numbers
     // assign the numbers to BigNumber and SmallNumber
     // If BigNumber is bigger then SmallNumber
     // see if they are evenly devisible
     // if they are, see if they are the same number
    
     using namespace std;
    
     int FirstNumber, SecondNumber;
     cout << "Enter two numbers.\n First: ";
     cin >> FirstNumber;
     cout << "\nSecond: ";
     cin >> SecondNumber;
     cout << "\n\n";
    
     if (FirstNumber >= SecondNumber)
     {
      if (FirstNumber % SecondNumber) == 0)
      {
       if (FirstNumber == SecondNumer)
       cout << "They are the same!";
       else
       cout << "They are evenly divisable.";
      }
      else
      cout << "They are not evenly devisable.";
     }
     cout << " Hey! The second one is larger.";
    
     return 0;
    }
    Error:
    error: expected primary-expression before '==' token
    error: expected ';' before ')' token

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    62
    Sorry for bothering already solved the issue.

    I missed one '(' on line 22.
    Code:
    if ((FirstNumber % SecondNumber) == 0)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Winsock problem
    By Wolf` in forum Windows Programming
    Replies: 1
    Last Post: 05-01-2010, 05:55 PM
  2. what am I missing? (Program won't compile)
    By steals10304 in forum C Programming
    Replies: 3
    Last Post: 08-25-2009, 04:01 PM
  3. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  4. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  5. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 02:29 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21