Sikenflossy
Member
- Joined
- Sep 20, 2009
- Messages
- 66
- Reaction score
- 0
- Points
- 6
What I want to do is have 10 dValue numbers, but if, of those 10 I only enter 5 values, the exe shouldnt ask me to enter all 10 and just add the 5 values I entered when I press the return key .. or something like that
//
// Add 3 numbers
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
double dValue1;
double dValue2;
double dValue3;
// enter three numbers
cout << "This program adds three numbers;\n";
cout << "Enter three integers:\n";
cout << "n1 - ";
cin >> dValue1;
cout << "n2 - ";
cin >> dValue2;
cout << "n3 - ";
cin >> dValue3;
// the sum
cout << "n1 + n2 + n3 = ";
cout << dValue1 + dValue2 + dValue3;
cout << "\n";
// wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
//
// Add 3 numbers
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
double dValue1;
double dValue2;
double dValue3;
// enter three numbers
cout << "This program adds three numbers;\n";
cout << "Enter three integers:\n";
cout << "n1 - ";
cin >> dValue1;
cout << "n2 - ";
cin >> dValue2;
cout << "n3 - ";
cin >> dValue3;
// the sum
cout << "n1 + n2 + n3 = ";
cout << dValue1 + dValue2 + dValue3;
cout << "\n";
// wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;