Hi all and thanks for the help! My intro class was in VB (I know lol).
I just started C++ and the syntax is giving me a problem. I know it's a quick fix but I'm stuck.
Why is the var I'm assigning a value to not being affected by the if statement? Driving me nuts.
Also please excuse the utter noobery of the programming style but like I said I'm just trying to get used to the syntax. Ignore the last cout/cin that is just there so i can see the program run.
#include "stdafx.h"
#include <iostream>
usingnamespace std;
int main()
{
int num1, num2, num3, sum, prod, avg, lrg, sml;
cout << "Hello, This program will display The sum, products, average, and the largest and \n";
cout << "and smallest of three numbers you enter...\n";
cout << "Please enter your first number...\n";
cin >> num1;
cout << "Please enter your second number...\n";
cin >> num2;
cout << "Please enter your third number...\n";
cin >> num3;
cout << '\n';
sum = num1 + num2 + num3;
cout << "Here is the sum of your numbers..." << sum << '\n';
cout << '\n';
prod = num1 * num2 * num3;
cout << "Here is the product of your numbers..." << prod << '\n';
cout << '\n';
avg = (num1 + num2 + num3) / 3;
cout << "Here is the average of your numbers..." << avg << '\n';
cout << '\n';
lrg = num1;
if (num2 > num1)
{
num2 = lrg;
}
elseif (num3 > num2)
{
num3 = lrg;
}
cout << "The largest of your numbers..." << lrg << '\n';
cout << '\n';
cout << '\n';
cin >> sml;
return 0;
}