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
Is c++ still in demand?
Tell me what are static member functions?
Difference between strdup and strcpy?
What is istream c++?
Write about a nested class and mention its use?
In a function declaration, what does extern mean?
What are the advantage of using register variables?
Explain the term memory alignment?
What are built-in functions? What is the syntax for the definition?
Write about c++ storage classes?
What is pointer -to-members in C++? Give their syntax?
What operators can you overload in c++?
What do you mean by early binding?
Write about all the implicit member functions of a class?
Explain linear search.