Create a c++ program that accepts 5 integers in ascending order without using array or looping. Pure else and if statements.

Recommended Answers

All 4 Replies

I just need it badly. I am going to fail my subject if i could not pass it until tommorow morning. Please help

Please help. Is there anyone here that can program that one? Please answer me. Thank you

No one is going to do your homework for you. If you hadn't waited to the last minute you could have posted your code and asked for help.

Using strictly your requirement this appears to be a 2 line exercise. Nowhere did you write the user input the values with cin or much else. You wrote the program accepts the 5 integers. This is a good example where the specification means a lot more than some folk think it does. The spec you supplied did not demand user input. So this is pretty easy and I worry that you need to spend time on your class work.

#include <iostream>

using namespace std;

int main()
{
  int a=1,b=2,c=3,d=4,e=5;
  cout << a << b << c << d << e << endl; 
  return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.