how to pass function return from switch
How to do i fix this code im not good at using function, im trying to pass a statement from switch to my double passengersR i always come out with a error
this output:
Name passenger:
Enter number passenger:
Choose from A to D
if choose A
Total Regular Passenger: 6.19624e-312
did i do something wrong im not really good at function and im trying to learn how to pass switch to void function
Code:
#include<conio.h>
#include <iostream>
#include <Iomanip>
#include <string>
using namespace std;
double passengersR ()
{
double m;
int num;
m=120*num;
return m;
}
int main()
{
double passengersR ();
double m;
char x ;
string Name;
float tickPrice;
int num;
string morePassengers,name;
cout<<"Enter Passenger Name:";
cin>> Name;
cout<<"Enter Number of passenger ";
cin >> num;
cout<<" A.Regular B.Student C.Senior D.Children ";
cin>>x ;
cout << endl << endl;
cout << x << endl ;
switch (x)
{
case 'a':
case 'A':
cout<<"Total Regular Passenger:" << m << endl;
break;
}
getch();
}