Write a program and call it sortcheck.cpp which receives 10 numbers from input and checks whether these numbers are in ascending order or not. You are not allowed to use arrays. You should not define more than three variables

Answer Posted / jobbine joseph

int main()
{
int Reading_num,Previou_num=-999999,i=0;
for(i=0;i<10;i++)
{
cin>>Reading_num;
if(Reading_num < Previous_num)
{
break;
}
Previous_num = Reading_num;
}
if(i<10)
{
cout<<"Numbers are Not in ASCENDING";
}
else
{
cout<<"Numbers are in ASCENDING ";
}

return(0);
}

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is c++ still in demand?

735


Tell me what are static member functions?

699


Difference between strdup and strcpy?

757


What is istream c++?

685


Write about a nested class and mention its use?

721






In a function declaration, what does extern mean?

713


What are the advantage of using register variables?

745


Explain the term memory alignment?

789


What are built-in functions? What is the syntax for the definition?

678


Write about c++ storage classes?

870


What is pointer -to-members in C++? Give their syntax?

688


What operators can you overload in c++?

675


What do you mean by early binding?

690


Write about all the implicit member functions of a class?

690


Explain linear search.

715