second program problem

hey this is a simple code but i keep getting the same error for line nine, not so sure how to fix it. This is the error-Untitled2.cpp:9: error: `end' undeclared (first use this function)
Untitled2.cpp:9: error: (Each undeclared identifier is reported only once for each function it appears in.)

make.exe: *** [Untitled2.o] Error 1

Execution terminated


1
2
3
4
5
6
7
8
9
10
  #include <iostream>
 int main()
 {
     int x = 5;
     int y =10;
     std::cout << 
     std::cout << x + y << " " << x * y;
     std::cout << end
     ;return 0;
 } 
end has never been declared
do you mean endl?
that would be std::endl;

std::cout <<
?
Last edited on
oh do you mean like this:
include <iostream>
int main()
{
int x = 5;
int y =10;
std::cout << end1;
std::cout << x + y << " " << x * y;
std::cout << end
;return 0;
}
Besides what metulburr has said, look at that semicolon at the beginning of line 9.
thanks but i still get four errors. The errors are
C:\Dev-Cpp\Untitled2.cpp In function `int main()':
6 C:\Dev-Cpp\Untitled2.cpp `end1' undeclared (first use this function)

(Each undeclared identifier is reported only once for each function it appears in.)
9 C:\Dev-Cpp\Untitled2.cpp `end' undeclared (first use this function)

9 C:\Dev-Cpp\Untitled2.cpp expected `;' before "return"
C:\Dev-Cpp\Makefile.win [Build Error] [Untitled2.o] Error 1

#include <iostream>
int main()
{
int x = 5;
int y =10;
std::cout << end1;
std::cout << x + y << " " << x * y;
std::cout << end
return 0;
}
endl (with an L) not end1
also moved the semicolon from the beginning of return to the end of the line that didnt have it
added # to include
added std:: to endl

I think this is what you are trying?
1
2
3
4
5
6
7
8
9
10
#include <iostream>
int main()
{
    int x = 5;
    int y =10;
    std::cout << std::endl;
    std::cout << x + y << " " << x * y;
    std::cout << std::endl;
    return 0;
} 
Last edited on
Topic archived. No new replies allowed.