I have an assignment from my CSCI class where I am tottally out of my element. If I could have some help with creating a program, it would be much appreciated. ANY kind of help would be helpful.
Sorry, but no user input, not sure what you mean by 'hello world', no user input (i think), and we have to create a loop?
I'll try starting the program the best I can, but this isn't my best of subjects due to many reasons, so hopefully you can guide me in the right direction.
#include <iostream>
using namespace std;
int main()
{
int = 1
int = max
int = min
int = sum
}
while ..
Not too sure what I could do after declaring the variables. I'm sure I haven't even declared the variables correctly..
#include<iostream>
usingnamespace std;
int main(){
int userNumbers[10],counter=1,sumTotal = 0,maxNum,minNum;
cout << "You will be asked to input 10 numbers\n\n";
cout << "Please enter your first number: ";
cin >> userNumbers[0];
while (counter < 10){
cout << "Please enter your next number: ";
cin >> userNumbers[counter];
counter++;
}
//Loop that searches for min and max
maxNum = userNumbers[0];
minNum = userNumbers[0];
for (int x = 0; x < 10; x++){
if (userNumbers[x] > maxNum){
maxNum = userNumbers[x];
}
if (userNumbers[x] < minNum){
minNum = userNumbers[x];
}
sumTotal +=userNumbers[x];
}
cout << "\n\nThe Max Number is: " << maxNum;
cout << "\nThe Min Number is: " << minNum;
cout << "\nThe Sum is: " << sumTotal;
cout << "\nThe Average is: "<<sumTotal/10;
return 0;
}
good luck and if you still want to learn this language, this site, has a really good tutorial