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
Do class declarations end with a semicolon? Do class method definitions?
What do manipulators do?
What is a local reference?
Explain the differences between private, public and protected and give examples.
Should the this pointer can be used in the constructor?
Define linked lists with the help of an example.
How does class accomplish data hiding in c++?
What are the different types of comments allowed in c++?
Why we use #include conio h in c++?
What is the basic of c++?
Is c# written in c++?
Which c++ compiler is best?
True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends
Declare a class vehicle and make it an abstract data type.
What are the advantages of early binding?