+ 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
6 Respostas
+ 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
+ 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
+ 8
You are welcomed!
+ 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?
+ 1
this is amazing thank you so much
may i ask what does "std::" it do and is it
necessry
+ 1
wow you are amazing thanks for all that support ❤