I need to sort a series of 25 numbers, entered by the user from smallest to largest, then count the number of times the user entered the number "10". I can't use arrays and I have to use only for loops, can someone please help?

When you say you "can't use arrays", what exactly does that mean? Because it's quite impossible to sort anything when you can't retain it, and while you can use 25 variables to get the same effect as an array, that's totally insane. I can't imagine a teacher expecting you to do that unless they subscribe to the school of hard knocks and want to teach you the importance of arrays.

If you can't use arrays, did you set up your 26 (or 27) variables, yet?

You can't use arrays? Can you use linked lists or trees?
EDIT: How did we all reply at the same time?

well I can't use an array set up like "array[45]" the user just needs to enter 25 integers and the program needs to sort it and print the number of times the number "10" is printed.

never mind, i overestimated it.

#include <iostream>
using namespace std;

int main()
{
	int max;
	int min;
	int ten=0;
	int total;
	int i;
	cout << "Please Enter a number" << endl;
	cin >> max;

	min=max;
	total=max;

	if (max==10)
		ten++;
	for (int x=1; x<25; x++)
	{
		cout << "Please Enter a number" << endl;
		cin >> i;

		if (i>max)
			max=i;
		if (i<min)
			min=i;
		if (i==10)
			ten++;
		total += i;
	}
	cout << "Max =  " << max << endl << "Min =  " << min << endl << "There were  " << ten << " 'tens' entered" << endl; 
	
}
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.