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
What is the difference between an external iterator and an internal iterator? Describe an advantage of the external iterator.
What is function prototyping?
What is increment operator in c++?
How do you invoke a base member function from a derived class in which you’ve overridden that function?
Const char *p , char const *p What is the difference between the above two?
Describe friend function & its advantages.
Define whitespace in C++.
Which ide is best for c++?
What is microsoft c++ redistributable?
What is the object serialization?
If I is an integer variable, which is faster ++i or i++?
Which c++ compiler is best?
Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?
write a corrected statement in c++ so that the statement will work properly. x = y = z + 3a;
Is swift better than c++?