Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 / rajesh

I think this one is good answer...

#include<iostream>
using namespace std;

int main()
{
int prev = 0, next, i;

for(i = 0; i<5; i++)
{
cin>>next;
if(next > prev)
{
prev = next;
}
else
{
cout<<"not in ascending
order..\n"<<endl;
break;
}
}
if(i==5)
cout<<"Ascending order...\n"<<endl;
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

True or false, if you keep incrementing a variable, it will become negative a) True b) False c) It depends

2375


What is expression parser in c++

2493


What are static and dynamic type checking?

1075


Distinguish between new and malloc and delete and free().

1022


Explain the difference between static and dynamic binding of functions?

1066


Can we run c program in turbo c++?

1078


Can you Mention some Application of C/C++?

1068


How can an improvement in the quality of software be done by try/catch/throw?

1057


How does c++ structure differ from c++ class?

1120


What do you understand by pure virtual function? Write about its use?

997


We all know that a const variable needs to be initialized at the time of declaration. Then how come the program given below runs properly even when we have not initialized p?

1074


Where do I find the current c or c++ standard documents?

1083


What is pointer to array in c++?

1152


What is a node class in c++?

1067


If a header file is included twice by mistake in the program, will it give any error?

1040