@Wo1ves1n0/

Manish(Assignment 3) (Alternative)

C++

Alternative(Manish)(Assignment 3)

fork
loading
Files
  • main.cpp
main.cpp
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
38
39
40
41
/*
Computational Thinking
Assigment 3 template
"Torren Walker"
*/

#include <iostream>
using namespace std; 

int main() 
{
  int Result=0, length=0, smallest, largest, MyList[length]; 
  cout << "How many numbers are you checking for?: ";
  cin >> length; 
  for (int i=0; i<length; i++) 
  {
  	cout << "Enter number " << i+1 << ": ";
  	cin >> MyList[i];
  }
  smallest = MyList[0], largest = MyList[0];
	cout << endl << "Printing Array"<< endl << "--------------" << endl; 
  for (int i=0; i<length; i++)
  {
    Result+=MyList[i];
  	cout << MyList[i] << endl;
  }
  cout << "--------------" << endl << "Adding your list of numbers" << endl << "--------------" << endl << "Total: " << Result << endl <<"--------------"<< endl;
    for (int i=0; i < length; i++) 
	{
		if (MyList[i] > largest) 
		{
			largest = MyList[i];
		}
		if (MyList[i] < smallest) 
		{
			smallest = MyList[i];
		}
	}
	cout << "Largest integer: " << largest << endl << "--------------" << endl <<	"smallest integer: " << smallest << endl << "--------------" << endl;
	return 0;
}