Also I think certain variables aren't being initialized as well mainly 'b'.
#include "stdafx.h"
#include <iostream>
#include <cmath>
#include<iomanip>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
float a,b,c,avg,pro;
char choice;
cout<<"Enter three three-digit numbers, seperated by spaces: ";
cin >> a,b,c;
cout<<"Enter 'a' to average the number or 'p' to caculate the product: ";
cin >> choice;
if(choice == 'a')
{
avg=((a*b*c)/3);
cout<<"The average of "<<a<<", "<<b<<" and "<<c<<" is "<<setiosflags(ios::fixed)<<setprecision(2) <<avg;
}
if(choice == 'p')
{
pro=(a*b*c);
cout<<"The product of "<<a<<", "<<b<<" and "<<c<<" is "<<setiosflags(ios::fixed)<<setprecision(2) <<pro;
}
return 0;
}
It just says hit any key to continue failing to let user enter a or p to provide either average or product.