Solving math qustion using c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Solving math qustion using c++

since i am trying to learn about problem solving i am wondering how to solve a mathmatical qustion check it below and please tell me how to fix it https://code.sololearn.com/cDDFxVU90wUj/?ref=app i belive there is more than one answer

7th Apr 2017, 1:10 PM
Adam
6 Answers
+ 10
Now this is interesting! // please wait while I fix this code // fixed #include <iostream> int main() { for (int x = 0; x < 50; x++) { for (int y = 0; y < 50; y++) { if ((x*y) == 20 && x == (2*y-6)) { std::cout << x << std::endl; std::cout << y << std::endl; } } } return 0; } /* What the above code does, is to test values of x and y from 0 to 49 if they satisfy the equations given. Floating point answers are also possible with some tweaks */ // code created // https://code.sololearn.com/cmPOEA68Gmzz/?ref=app
7th Apr 2017, 1:29 PM
Hatsy Rei
Hatsy Rei - avatar
+ 8
If you prefer not to do global "using namespace std;", you have to type std:: in front of standard objects from iostream header. // link pending // link updated Please check out the reasons as to why some may prefer not to use it. https://www.sololearn.com/Discuss/294730/?ref=app
7th Apr 2017, 1:50 PM
Hatsy Rei
Hatsy Rei - avatar
+ 8
You are welcomed!
7th Apr 2017, 1:55 PM
Hatsy Rei
Hatsy Rei - avatar
+ 6
@Hatsy rei. What are all the standard objects to be typed with std:: in front of them? Actually I thought only objects from iostream header. But when I used setw() from iomanip header. It still needs to be typed as std::setw(); . And I suppose the objects which are used for output console are to be typed with std:: , right?
7th Apr 2017, 2:03 PM
Mr.Robot
Mr.Robot - avatar
+ 1
this is amazing thank you so much may i ask what does "std::" it do and is it necessry
7th Apr 2017, 1:44 PM
Adam
+ 1
wow you are amazing thanks for all that support ❤
7th Apr 2017, 1:55 PM
Adam