Help with error message: syntaz error befor "namespace"

This is a discussion on Help with error message: syntaz error befor "namespace" within the C++ Programming forums, part of the General Programming Boards category; I dont know why im getting this error message. Im using BloodShead Dev-C++ Code: #include <iostream> using namespace std; int ...

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    2

    Help with error message: syntaz error befor "namespace"

    I dont know why im getting this error message. Im using BloodShead Dev-C++

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main ()
    {
        int "one";
        int "two";
        int "three";
        
        cout << "Enter Your Score One: \n";
        cin >> one;
    
        cout << "Enter Your Score Two: \n";
        cin >> two;
    
        cout << "Enter Your Score Three: \n";
        cin >> three;
    
        adverage = one + two + three / 3 = yourAdvarge;
    
        cout << "Your Advarge: ";
    
        return 0;
    }

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,936
    These are wrong:
    Code:
    int "one";
    int "two";
    int "three";
    It looks like you want to define variables named one, two and three, so they should be:
    Code:
    int one;
    int two;
    int three;
    This is wrong because adverage and yourAdvarge are not declared, and because it looks like you are attempting to assign the value of yourAdvarge to an expression that should not be on the left hand side of an assignment:
    Code:
    adverage = one + two + three / 3 = yourAdvarge;
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Tweaking master Aslaville's Avatar
    Join Date
    Sep 2012
    Location
    Rogueport
    Posts
    183
    You also have to declare the variable 'adverage' and include parenthesis in the operation where ypu are getting the average.

  4. #4
    Registered User
    Join Date
    Oct 2012
    Posts
    2
    Thank you both for your help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. "is not a class or namespace name" error
    By blakeo_x in forum C++ Programming
    Replies: 13
    Last Post: 09-16-2011, 03:08 AM
  2. the operator "="error in class "String"
    By boyhailong in forum C++ Programming
    Replies: 9
    Last Post: 07-27-2011, 08:39 PM
  3. "Segment Violation" error, fopen("r+")
    By jiboso in forum C Programming
    Replies: 1
    Last Post: 03-10-2011, 08:57 AM
  4. "Expected undefined-id" Error Message
    By FlyingShoes12 in forum C++ Programming
    Replies: 2
    Last Post: 11-03-2009, 07:55 PM
  5. Replies: 2
    Last Post: 09-12-2006, 04:50 AM

Tags for this Thread


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