Expected Unqualified-id error in Xcode

Hello! I am very new to code and I also have a mac which made this a little confusing. Anyways, i have fixed all of my errors in this code thus far and I am still getting an "Expected Unqualified-id" error message. It does not specify where the error is. Can anyone look this over and help me out? Thanks!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream> // allows program to perform input and output
using std::cout; // program uses cout
using std::endl; // program uses endl
using std::cin; // program uses cin

int main();

{
    int number;
    int number1; // first integer read from user
    int number2; // second integer read from user
    int number3; // third integer read from user
    int smallest; // smallest integer read from user
    int largest; // largest integer read from user
    int sum; // sum of integers read from user
    double average; // average of integers read from user
    int product; // product of integers read from user
    std::cout << "Input three different integers: "; // prompt
    cin >> number1 >> number2 >> number3; /* write a statement to read in values for number1, number2, and number3 using a single cin statement */
    largest = number1; // assume first integer is largest
    if (number2 > largest)
        cout << number2 << ">" << largest << endl; /* write a statement to determine if number2 is greater than largest. If so assign number2 to largest*/
    if (number3 > largest)
    cout << number3;
    number3 = largest; /* Write a statement to determine if number3 is greater than largest. If so assign number3 to largest */
    smallest = number1; // assume first integer is smallest
    if (number2 < smallest)
        cout << number2 << "<" << smallest << endl; /* Write a statement to determine if number2 is less than
        smallest. If so assign number2 to smallest */
    if (number3 < smallest)
    cout << number3;
    number 3 = smallest; /* Write a statement to determine if number3 is less than smallest. If so assign number2 to smallest */
    std::cout << "The answers are: ";
        cout << "Largest = " << largest
        << "Smallest = " << smallest
        << "Sum = " << number1 + number2 + number3
        << "Average = " << (number1 + number2 + number3) / 3
        << "Product = " << number1 * number2 * number3 << endl; /* write an output statement that prints the largest, smallest, sum, average, and product */
    return 0;
    }
 // end main 
Line 6 should not have a semi colon.

There are probably other errors, I'll see if i can compile it.

edit..

Looks like line 32 also needs to be fixed. It should be Number3 instead of Number 3

I'm not sure what exactly your program is suppose to do but that should fix all the compile errors.
Last edited on
That worked, thanks!
Topic archived. No new replies allowed.