Hello! I am new to this community and C++ so be easy on me :) I am having problems with the following. I am trying to get the highest and lowest numbers. The concept is easy but I can't get it to work for some reason. Any suggestions. Thanks in advance!
for (n=0;n<10;n++)
{
std::cout<<"Please enter your numbers==>"<
for (n=0;n<10;n++)
{
std::cout<<"Please enter your numbers==>"<
[Error: Irreparable invalid markup ('<std::flush;>') in entry. Owner must fix manually. Raw contents below.]
Hello! I am new to this community and C++ so be easy on me :) I am having problems with the following. I am trying to get the highest and lowest numbers. The concept is easy but I can't get it to work for some reason. Any suggestions. Thanks in advance!
for (n=0;n<10;n++)
{
std::cout<<"Please enter your numbers==>"<<std::flush;
std::cin>>x;
if (x>highestx)
{
highestx=x;
lowestx=highestx; //I think this is the problem but if I remove it, then it doesn't work at all
}
if (x<lowestx)
{
lowestx=x;
}
}
ps, this is just a snippet of code. Everything is declared.
for (n=0;n<10;n++)
{
std::cout<<"Please enter your numbers==>"<<std::flush;
std::cin>>x;
if (x>highestx)
{
highestx=x;
lowestx=highestx; //I think this is the problem but if I remove it, then it doesn't work at all
}
if (x<lowestx)
{
lowestx=x;
}
}
ps, this is just a snippet of code. Everything is declared.
