0
I can't fix it tell what to do
6 Respostas
+ 1
// Created by Mahmoud Qasrawi
#include <iostream>
using namespace std;
int main()
{
char c;
float x, y, z, av, sum;
 
 cout<< "if you want to calculate the avareg of three numbers enter A please and if you want to calculate the summation of tow numbers enter S please "<<endl;
 
 cin>>c;
 
     if ((c=='a')||(c=='A'))
 {
 cin>>x;
 cin>>y;
 cin>>z;
 av=(z+y+x)/3.0; 
 cout<<"the average is"<<av;
 }
 
 else 
     if ((c=='s')||(c=='S'))
 {sum=x+y;
 cout<<"the summation is"<<sum;
  }
 
 else 
 cout<<"invaild input!!!!";
      return 0;
 }
+ 1
Give input as ::: a 1 2 3 then submit. It will print 2
0
Change:- 
#include <iostream>
int main();
char c;
To:-
#include <iostream>
using namespace std;
int main()
{
char c;
0
The wrong you don't give the variables x , y , z value 
So the program cant calculate the average 
Solution: 
Give the variables initial values or let the user input them there values .
Ex: x =7; 
y=56; 
z=13 ; 
Then run the code
0
I want the user to put the values
0
You have to delete this  character ( } )  from line 9 
Then after if ((c == 'a' )|| (c=='A')){
// Wright this code 
cin>>x ;
cin>>y;
cin>>z;
//Then write your code as it in the document 
av = ...........







