[Error] Id returned 1 exit status

Hi, I'm just beginning computer programming for a class in school. I adapted the program from http://www.cplusplus.com/doc/tutorial/introduction/ to output a product instead of a sum... or at least I tried to. When I attempted to compile it with the Dev C++ compiler, it gave the message "[Error] Id returned 1 exit status".

This is the program text:

1
2
3
4
5
6
7
8
9
10
11
12
13
 int a, b, prod;

cout << This program is designed to find the product of two numbers of your choosing. Use it to help you with math problems, or just have fun!;
     
cout << Please enter your first variable, a.;
cin >> a;
cout << Thank you. Now, enter your second variable, b.;
cin >> b;
cout << Thank you.; 
             
prod = a * b;
cout << sum << endl;


Could someone help me, and maybe tell me how to fix this problem? I've been looking online, and I can't find this same problem with a program like mine. :/

Thank you! :)
Is this your whole code? I mean, I'm assuming you have a main function, right?

You also need to ensure that the text your passing into you std::cout stream is enclosed in speech marks.
I'm sorry... no, I don't have a main function... and what do you mean by the 'std::cout'? Sorry, I just started a day ago...
From the tutorial:
1
2
3
4
5
6
7
// my first program in C++
#include <iostream>

int main()
{
    std::cout << "Hello World!";
}


http://www.cplusplus.com/doc/tutorial/program_structure/

Whenever you start to learn a new programming language, it's almost traditional to start out with the "hello world" program. This ensures that the environment is set up correctly, so that the editor, compiler and linker are all working. It gives an example of almost the simplest possible program.

what do you mean by the 'std::cout'
cout is used to send something (text or numbers etc.) to the standard output device - usually the console or screen. Now cout is contained inside something called the standard namespace (which you will learn about later). In the example program, the prefix std:: is used to tell the compiler that.
I tried to do that program, and it compiled it well, but when I ran it, it said, "Failed to execute 'C:\Users\Liza\OneDrive\Documents\HELLO WORLD III.exe':
Error 193: %1 is not a valid Win32 application...
You need to #include <iostream> and u need to put your code into a main class

eg.

1
2
3
4
5
6
7
8
9
10
11
#include <iostream>

int main ()
{
int a, b, prod;

cout << This program is designed to find the product of two numbers of your choosing. Use it to help you with math problems, or just have fun!;
     
cout << Please enter your first variable, a.;
// ...
}
Error 193: %1 is not a valid Win32 application

I've not seen this message very often. One possibility is that the path or filename is incorrect. You could try renaming your program so that there are no spaces in the filename. Also, try using explorer to view the contents of the folder "C:\Users\Liza\OneDrive\Documents\" and verify that the program "HELLO WORLD III.exe" is actually found there.
Topic archived. No new replies allowed.