Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
#include
#include <iostream>

main(){
    using namespace std;
    cout << "Finish the math problem." << endl;
    int x;
    int y;
    x = 5;
    y = 5;
    cout << "The answer is" x + y << endl;
    cout << "The answer is" x * y << endl;
    cout << "The answer is" x / y << endl;
    cout << "The answer is" x - 4 << endl;
    cout << "The answer is" x - 2 << endl;
    cout << "The answer is" x / 10 << endl;
}

This doesn't work for me?
Posted
Updated 22-Sep-16 2:36am
v2
Comments
[no name] 22-Sep-16 8:24am    
"This doesn't work for me?", how would we know what does and does not work for you? We do not know anything at all about your homework assignment. Ask your teacher to help you.

You should try to replace:
C++
cout << "The answer is" x + y << endl;

with
C++
cout << "The answer is" << x + y << endl;
 
Share this answer
 
Comments
CPallini 22-Sep-16 8:33am    
5, of course.
Patrice T 22-Sep-16 8:34am    
thank you
Quote:
This doesn't work for me?

Because you didn't read the documentation: istream::operator>> - C++ Reference[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900