it seems that I'm stuck at c++ yet again. woohoo.
#include <iostream>
#include <fstream>
using namespace std;
int main() {
int amount = 0;
int inputNumber = 0;
int temp = 0;
int n = 0;
int lowest;
int highest;
double averages;
cout << "Welcome to simple calculator. Where you can use for average, highest amd lowest value.";
cout << "Please input all the number you plan to use to calculate. ";
cout << "Finish your input by enter any letter and then press on enter. " << endl;
while(cin >> inputNumber)
{
if (inputNumber < lowest) {
int (lowest = inputNumber);
}
else if(inputNumber > highest){
int (highest = inputNumber);
}
amount = amount += inputNumber;
n++;
}
double averages = amount / n;
cout << "Your lowest value is: " << lowest << endl;
cout << "Your highest value is: " << highest << endl;
cout << "Your average value is: " << averages << endl;
cout << "Amount is " << amount << endl;
cout << n << endl;
return 0;
}
but when I put in numbers it doesn't work properly. like
3
5
d
Your lowest value is: 3
Your Highest value is: 5
Your average value is: 4
2
-2
-3
a
Your lowest value is: -3
Your Highest value is: 0
Your average value is: -2
2
Idk why it do this and I'm still new to C++, I also have to code it in Linux and use G++
Thanks in advance if you could help me out.