#include <iostream>
using namespace std;
int main()
{
char a = 0, b = 1, ch1, ch2, ch3, ch4, chsum;
float num1, num2, num3, sum, avg;
cout<<"Enter Character 'a' or 'b': "; //asking user to enter character a or b
cin>>ch1;
if (ch1 == a)
{
cout<<"Enter three floating-point numbers: " << endl;
cout<<"First number: ";
cin>>num1;
cout<<"Second number: ";
cin>>num2;
cout<<"Third number: ";
cin>>num3;
sum = num1+num2+num3;
avg = (num1+num2+num3)/3;
cout<<"The sum of your numbers is: " << sum << endl;
cout<<"The average of your numbers is: " << avg << endl;
}
else if (ch1 == b)
{
cout<<"Enter the intials of your first, middle, and last name: " << endl;
cout<<"First initial: ";
cin>>ch2;
cout<<"Second initial: ";
cin>>ch3;
cout<<"Third initial: ";
cin>>ch4;
chsum = ch2+ch3+ch4;
cout<<"Your complete initials are: "<< chsum << endl;
}
system("pause");
}
When executed, the program does ask for the user to enter a character 'a' or 'b', but after that it goes no where....where am i going wrong?