plz solve my question i don't know what to do!!

CHALLENGE! Write a program that asks the user to type 10 integers and writes the smallest value?

write the program in c++
cin 10 values and cout the smallest one

1
2
3
4
5
6
7
8
9
10
11
12
13
14

#include<iostream.h>
#include<conio.h>
using namespace std;
main()
{
     



getch();
return(0);
}
Last edited on
1
2
3
4
5
6
{
cout<<"User, type 10 integers: ";
cin>>integers;
cout<<"Write the smallest value: "<<smallest<<endl;
return 0;
;)
sort it out

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>

using namespace std;

int main()
{
	int array[10];
	
	for ( int i = 0 ; i < 10 ; ++i )
	{
		cout<<i<<" value is: ";
		cin>>array[i];
	}

	cout<<"\nSorting your array...\n";

	for ( int i = 0 ; i <= 9 ; ++i )
	{
		for ( int j = i + 1 ; j <= 9 ; ++j )
		{
			if ( array[i] > array[j] )
			{
				int temp = array[i];
				array[i] = array[j];
				array[j] = temp;
			}
		}
	}

	for ( int i = 0; i < 10 ; ++i )
	{
		cout<<array[i]<<"\n";
	}

	system("pause");
	return 0;
}
Topic archived. No new replies allowed.