Problem with if else multiple condition
this problem has been solved...thank you very much forum members :)
Last edited on
You have to use ==
instead of=
in lines 28 and 32,since you are comparing values, not assigning left value to right.
now no answer coming out...just blank... :(
I rewrote your code since I'm not so familiar with printf, scanf and other C syntax. Maybe you should use cout and cin?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
#include <stdio.h>
#include <iostream>
using namespace std;
int main ()
{
printf("Welcome to Sayang Pintar Kindergarten and Nursery\n");
printf("-------------------------------------------------\n\n");
printf("Packages offered are as follows.\n\n");
printf("Package 1: Kindergarten (8.30 a.m. - 12.30 p.m.)\n");
printf("Monthly fee for package 1: RM170.00\n\n");
printf("Package 2: Kindergarten and Nursery (7.00 a.m. - 6.00 p.m.)\n");
printf("Monthly fee for package 2: RM320.00\n\n");
printf("Package 3: Kindergarten and extended Nursery (7.00 a.m. - 6.00 p.m.)\n");
printf("Monthly fee for package 3: RM440.00\n\n");
double package1,package2,package3;
int number_of_package;
package1=170.00;
package2=320.00;
package3=440.00;
cout<<"Please choose your package: 1, 2 or 3: ";
cin>> number_of_package;
if (number_of_package==1){
cout<<package1;}
else if (number_of_package==2)
{cout<<package2;}
}
|
thanks for your help...since i wasnt allowed to use cout and cin for my assignment...i try to figure out...and i done it...thank you for your help
Topic archived. No new replies allowed.