Error: type 'int' unexpected

not sure how to fix this error

Page 1 of 1

2 Replies - 5225 Views - Last Post: 17 December 2008 - 09:10 AM Rate Topic: -----

#1 newjohnwu  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 27
  • Joined: 16-October 08

Error: type 'int' unexpected

Posted 17 December 2008 - 08:51 AM

i'm not sure how to fix this at all
not so much for x, y being undeclared
but mostly on the last 3, since i never really learn how to fix that.

much thankyou

cpp(16) : error C2065: 'x' : undeclared identifier
cpp(16) : error C2065: 'y' : undeclared identifier
cpp(33) : error C2062: type 'int' unexpected
cpp(39) : warning C4804: '<=' : unsafe use of type 'bool' in operation
cpp(40) : warning C4390: ';' : empty controlled statement found; is this the intent?

#include <iostream>
using namespace std;

void swap (int, int);

int main() {
	int s1, s2, s3;
	int total;
	int x1;

	cout<<"Please input the last three values:";
	cin>>s1>>s2>>s3;
	double avg = (s1+s2+s3)/3;
	cout<<"Average for the values:;s1<<", "<<s2<<", "<<s3<<;is:<<avg";
	cout<<"Please enter two number:";
	cin>>x,y;
	cout<<"The sum of<<x<<and<<y<<is:"<<x+y<<endl;
	cout<<"Please enter a number:";
	cin>>x1;
	total = total + x1;
	cout<<"please enter another number:";
	int x2;
	cin>>x2;
	total +=x1;
	
	while (cin)
	{
		cin>>x1;
		total +=x1;
	}

	if 
		int = "N" || int = "NO";
	{
		return 0;
	}

	if (x = 1) y++; else if(x=2) y+=2;
	if (1 <= x <= 10) cout <<"Enter y:"; cin>>y;
	if (total>0); cout <<total<< "total";

	int a=3;
	int b=4;
	swap(x,y);
	cout<<x<<" "<<y<<endl;

	int i;
	for (i=-10; i<10; i++);
	{
		int i;
		for (i=-10; i<10; i++)
			cout<<i;
		cout<<endl;
	}
	
	for(i=-10; i<=10; i+=2)
		cout<<i<<endl;

	return 0;
}



Is This A Good Question/Topic? 0
  • +

Replies To: Error: type 'int' unexpected

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6052
  • View blog
  • Posts: 23,487
  • Joined: 23-August 08

Re: Error: type 'int' unexpected

Posted 17 December 2008 - 09:04 AM

You need to work on the most basic of syntax. Try here.
Was This Post Helpful? 0
  • +
  • -

#3 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Error: type 'int' unexpected

Posted 17 December 2008 - 09:10 AM

Modified title to be more descriptive of the problem.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1