What's new

Closed C++

Status
Not open for further replies.

Bapangsenpai

Honorary Poster
select school code:_
[A]=student=100
=faculty=200
[C]=admin=300
select a meal:_
[1] chicken=50
[2] pig=100
[3] goat=150
select movie:_
[z] jan
[x] mar
[y] khalifa
select venew;_
[M] room1
[N] Room2
[O] Room3

welcome guest:_ //student,faculty,admin
your meal is:_ //chicken,pig,goat
your movie:_//khalifa,jan,mar
your pay amount:_//movie+student+meal
your room:_ //1,2,3
enjoy watching:_?//hindi ko alam yan


Pahelp po ganyan po lilitaw sa output ng c++ yung pong may slash dina kasama yun. Midterm lang po reviewer Thanksss!!
 
Ganito lang naman yan eh

Code:
    int intGuest;
    cout << "[0] Student";
    cout << "[1] Teacher";


    cout << "Enter your choice: ";
    cin >> intGuest;


    if ( intGuest == 0)
    {
        cout << "Welcome guest student " << endl;
   }else if ( intGuest == 1)
    {
        cout << "Welcome guest  teacher" << intStudent << endl;
  
    }else{
        cout << "wrong input";
   }

Ganyan lang naman boss ang nang nested, Goodluck!
 
Ganito lang naman yan eh

Code:
    int intGuest;
    cout << "[0] Student";
    cout << "[1] Teacher";


    cout << "Enter your choice: ";
    cin >> intGuest;


    if ( intGuest == 0)
    {
        cout << "Welcome guest student " << endl;
   }else if ( intGuest == 1)
    {
        cout << "Welcome guest  teacher" << intStudent << endl;
 
    }else{
        cout << "wrong input";
   }

Ganyan lang naman boss ang nang nested, Goodluck!
thx boss pero pwedeng pagawa na lahat boss. Para lang sa midterm libre nalang kitang load
 
#include<iostream>
#include<string.h>
using namespace std;
main()
{
float a,s,d,f,g;
char code1,code2,code3,code4;

cout<<"\n[A] Student = 100";
cout<<"\n Faculty = 200";
cout<<"\n[C] Admin = 300";

cout<<"\nSelect School Code:";
cin>>code1;

if(code1== 'A' || code1== 'a')
{
a = 100;


}
else if(code1== 'B' || code1 == 'b')
{
a = 200;
}

else if(code1== 'C' || code1== 'c')
{
a = 300;
}

cout<<"\n[1] Chicken = 50";
cout<<"\n[2] Pig = 100";
cout<<"\n[3] Goat = 150";

cout<<"\nSelect Meal:";
cin>>code2;

if(code2== '1' || code2== '1')
{
s= 50;

}
else if(code2== '2' || code2== '2')
{
s= 100;
}

else if(code2== '3' || code2== '3')
{
s= 150;
}


cout<<"\n[Z] Avengers = 200";
cout<<"\n[X] The Matrix = 210";
cout<<"\n[C] Batman = 220";

cout<<"\n Select Movie:";
cin>>code3;

if(code3== 'Z' || code3== 'z')
{
d= 200;
}
else if(code3 == 'X' || code3 == 'x')
{
d= 210;
}

else if(code3== 'C' || code3== 'c')
{

d = 220;
}

cout<<"\n[M] Room 1";
cout<<"\n[N] Room 2";
cout<<"\n[O] Room 3";

cout<<"\nSelect Room:";
cin>>code4;

if(code4 == 'M' || code4 == 'm')
{


f= a + s+ d;
cout<<"\nTotal Pay Amount:"<<f;
cout<<"\nYour room is: Room 1";
cout<<"\nEnjoy!!";


}

else if(code4 == 'N' || code4 == 'n')
{

f= a +s +d;
cout<<"\nTotal Pay Amount:"<<f;
cout<<"\nYour room is: Room 2";
cout<<"\nEnjoy!!";


}

else if(code4 == 'O' || code4 == 'o')
{

f= a+ s+ d;
cout<<"\n\nTotal Pay Amount:"<<f;
cout<<"\nYour room is: Room 3";
cout<<"\nEnjoy!!";

}


}
 
simple lang, edi sa huli ka na mag cout ng mga result, basta cin lang muna ng cin

Code:
#include<iostream>
#include<string.h>
using namespace std;
main()
{


float a,s,d,f,g;
char code1,code2,code3,code4;

cout<<"\n[A] Student = 100";
cout<<"\n[B] Faculty = 200";
cout<<"\n[C] Admin = 300";

cout<<"\nSelect School Code:";
cin>>code1;

cout<<"\n[1] Chicken = 50";
cout<<"\n[2] Pig = 100";
cout<<"\n[3] Goat = 150";

cout<<"\nSelect Meal:";
cin>>code2;

cout<<"\n[Z] Avengers = 200";
cout<<"\n[X] The Matrix = 210";
cout<<"\n[C] Batman = 220";

cout<<"\n Select môviê:";
cin>>code3;

cout<<"\n[M] Room 1";
cout<<"\n[N] Room 2";
cout<<"\n[O] Room 3";

cout<<"\nSelect Room:";
cin>>code4;


if(code1== 'A' || code1== 'a')
{
a = 100;


}
else if(code1== 'B' || code1 == 'b')
{
a = 200;
}

else if(code1== 'C' || code1== 'c')
{
a = 300;
}


if(code2== '1' || code2== '1')
{
s= 50;

}
else if(code2== '2' || code2== '2')
{
s= 100;
}

else if(code2== '3' || code2== '3')
{
s= 150;
}

if(code3== 'Z' || code3== 'z')
{
d= 200;
}
else if(code3 == 'X' || code3 == 'x')
{
d= 210;
}

else if(code3== 'C' || code3== 'c')
{

d = 220;
}

if(code4 == 'M' || code4 == 'm')
{


f= a + s+ d;
cout<<"\nTotal Pay Amount:"<<f;
cout<<"\nYour room is: Room 1";
cout<<"\nEnjoy!!";


}

else if(code4 == 'N' || code4 == 'n')
{

f= a +s +d;
cout<<"\nTotal Pay Amount:"<<f;
cout<<"\nYour room is: Room 2";
cout<<"\nEnjoy!!";


}

else if(code4 == 'O' || code4 == 'o')
{


f= a+ s+ d;
cout<<"\n\nTotal Pay Amount:"<<f;
cout<<"\nYour room is: Room 3";
cout<<"\nEnjoy!!";

}

}
 
Last edited:
Status
Not open for further replies.
Back
Top