Hi,
I wanted to find about few things that I didnt see in tutorials in this page.
I've been working on very simple program for few hours, but I still cant figure out few things, can't find them either.
This is the code I came up with.
is it possible to input unlimited amount of nummbers nut just number 1 + number 2?Code:#include <iostream> using namespace std; int main () { int a, b; float result; cout << "Please enter first number" << endl; cin >> a; cout << "Please enter second number" << endl; cin >> b; cout << "Average is" << endl; result = (a + b)/2.0; cout << result << endl; system ("pause"); return (0); }
If yes then how ? for example 1+45+34
And how can I change result function so it understands how many numbers I have inputed and calculates the average value?
If I input a letter instead of nummber how can I make it so program says that it is invalid input value or something like that ?
Thank you in advance,
I read topics about posting and homework and I hope that I don't offend anyone with this topic
P.S Sorry for any english mistakes !



LinkBack URL
About LinkBacks


