I keep on getting one error when I compile this. I can't figure out what is wrong with it. Please help.

//Write a program that asks the user to enter two integers.  
//The program should divide the first integer by the second and then display the resulting quotient and remainder.

#include <iostream.h>

//using namespace std;

int main()
{
	//Declare the variables

	int il, i2,  quotient, remainder;

// Obtain the data from the user

	cout<<"Input an integer followed by a return: ";
	cin>>i1;

	cout<<"Input an integer followed by a return: ";
	cin>>i2;
	
// Do the arithmetic

quotient= i1/i2;
remainder=i1 % i2;

// Output the results

    cout<<"\nThe quotient of " << i1 << " and "<< i2 <<"is"<< i1/i2;
	cin>>il;
	cout<<"The quotient of " << i1 << " and "<< i2 <<"is"<< i1/i2;
	cin>>i2;
	cout<<"\nThe remainder when "<<i1<<" is divided by "<<i2<<"is"<< remainder;


return 0;
}

error C2065: 'i1' : undeclared identifier
Error executing cl.exe.

Did you mean to have an il and and i1? I'm no C++ guru or anything, but it doesn't look like you ever declared i1 -- that's all.

#include <iostream.h>

//using namespace std;

int main()
{
	//Declare the variables
             //[B]error is here! u want delcare  "i1"  but here u declare it "il"     accidently[/B] 
	int [B]il[/B], i2,  quotient, remainder;

// Obtain the data from the user

	cout<<"Input an integer followed by a return: ";
	cin>>i1;

	cout<<"Input an integer followed by a return: ";
	cin>>i2;
	
// Do the arithmetic

quotient= i1/i2;
remainder=i1 % i2;

// Output the results

    cout<<"\nThe quotient of " << i1 << " and "<< i2 <<"is"<< i1/i2;
            //[B]here again error[/B]
	cin>>[B]il[/B];
	cout<<"The quotient of " << i1 << " and "<< i2 <<"is"<< i1/i2;
	cin>>i2;
	cout<<"\nThe remainder when "<<i1<<" is divided by "<<i2<<"is"<< remainder;


return 0;
}

how do i declare i1 ?

Wait a minnnit....

You don't know how to declare variables? What about this part in your code?

[b]//Declare the variables[/b]

	int il, i2,  quotient, remainder;

You declared some variables RIGHT THERE! How could you know to initialize variables there, but then forget? Did you copy this code, or something? Without stepping too far out on a ledge, I'll bet you could initialize i1 by

//Declare the variables

	int i1, i2,  quotient, remainder;

Like kakilang, you used il several times instead of i[/b]1[/b]

Just a hint! Mixing up l and 1 are easy to do and hard to catch reading the code. I would use slightly more meaningful variable names like q and r. Also avoid using the often used i in loops and counters, it is another hard to read character, replace with k or such.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.