I have to displays the results of the following arithmetic expressions, in this order:
• a − b
• ab
• (a + b)2
• (a + b) ∗ (a − b)
by entering first 2 values , when system goes into 3rd value it displays the whole line of coding, please check my coding if im making any mistake
std::cout << "Enter 'a' : ";
std::cin >> a;
std::cout << "Enter 'b' : ";
std::cin >> b;
std::cout << endl;
std::cout << "a - b = " << a - b << endl;
std::cout << "a / b = " << a / b << endl;
std::cout << "(a + b)^2 = " << (a + b) * (a + b) << endl;
std::cout << "(a + b) * (a - b) = " << (a + b) * (a - b) << endl;
I assume there's a copy-paste font mishap there, because ab certainly isn't a/b.
You haven't shown full code, but based on just the excerpt you have provided, I don't see anything flagrantly wrong.
by entering first 2 values , when system goes into 3rd value it displays the whole line of coding, please check my coding if im making any mistake
Are you saying that you don't like it that the program allows the user to enter two values on the same line? e.g.
3 2 <enter>?
You want to force the user to do:
3 <enter>
2 <enter>?
Why do you want the user to be forced to do this? Is that actually a requirement?
PS: You are posting in the UNIX/Linux section, but your code has nothing *nix-specific in it. You'd get more responses if you posted in the Beginners section.
thanks i have fix the problem. but really thanks for ur kind response, actually it was server putty problem. now it got fixed
im doing programs on linux system thats y i posted here