Getting an Error Message

Not sure why I am getting an error message with this code. Could someone please point me in the right direction?

error messages: 1 IntelliSense: this declaration has no storage class or type specifier
2 IntelliSense: expected a declaration
3 IntelliSense: this declaration has no storage class or type specifier
4 IntelliSense: expected a declaration
5 IntelliSense: expected a declaration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

#include <iostream>
#include <iomanip>
using namespace std;

int main()

	//Variables
	char code = ' ';

// Enter Input
cout << "Is this item available";
cin >> 

if (toupper (code) = 'X')
	cout << "Discontinued" << endl;
else
{ 
	cout << "Available" << endl;
	cout << "The item will be shipped ASAP" << endl;
	return(0);
} // end if 
Last edited on
cin >>

cin to what? You have to have a variable on the right to store the input in.
Last edited on
Ok that was my over sight.

Here is the errors I am getting now.

Error 1 error C2106: '=' : left operand must be l-value
In the if statement.

Also
2 IntelliSense: expression must be a modifiable l-value
In the if statement
Last edited on
toupper (code) == 'X'
@Diana Magers

Try changing this if (toupper (code) = 'X') to this, if (toupper (code) == 'X') and see if that helps. A single equal sign, assigns a value, while a double equals, checks the value. Think of it as "If(uppercase (code) IS EQUAL TO 'X') then do this or that."
NNNIINNNnnnn.... JAR!
Got cha. Thank you.
Topic archived. No new replies allowed.