0

Final Edit: lol im dumb but the brackets backwards

#include <iostream.h>

int main()
{
const int SIZE = 10;
int numbers[SIZE];

int count1;
int count2;
int highest;
int lowest;


cout << "Enter an array of ten and I will find the highest and lowest" ;
cout << " values" << endl;

cin >> numbers[0];
cin >> numbers[1];
cin >> numbers[2];
cin >> numbers[3];
cin >> numbers[4];
cin >> numbers[5];
cin >> numbers[6];
cin >> numbers[7];
cin >> numbers[8];
cin >> numbers[9];


highest = numbers[0];
for (count1 =1; count1 < SIZE; count1 ++)
{
	if (numbers[count1] > highest)
	highest = numbers[count1];
}

lowest = numbers[0];
for (count2 = 1; count2 < SIZE; count2++)
{
	if (numbers[count2] < lowest)
		lowest = numbers[count2];
}

cout >> "The lowest values is " >> lowest >> endl;
cout >> "The highest values is " >> highest >> endl;

return 0;

}

Compiling LARGESTS.CPP:
Error LARGESTS.CPP 43: Illegal structure operation in function main()
Error LARGESTS.CPP 44: Illegal structure operation in function main()

Edited by Lando_: forgot brackets :C

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by seanbp
0

I think you should use indenting whitespace.

cout >> "The lowest values is " >> lowest >> endl;
cout >> "The highest values is " >> highest >> endl;

should be

cout << "The lowest values is " << lowest << endl;
cout << "The highest values is " << highest << endl;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.