0% found this document useful (0 votes)
2 views3 pages

Program Code

Uploaded by

Marvin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Program Code

Uploaded by

Marvin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

#include <iostream>

using namespace std;


int main(){

int age;
char gender;
cout<<"Enter your age: "; cin>>age;
if (age >=18){
cout<<"Enter your gender: "; cin>>gender;
if (gender == 'M' || gender == 'm'){
cout<<"Your color is BLUE.";
}
else if (gender == 'F' || gender == 'f'){
cout<<"Your colos is PINK.";
}
else {
cout<<"Invalid Gender.";
}

}
else {
cout<<"You are too young";
}

return 0;
}
_________________

#include <iostream>
using namespace std;
int main(){

int soldCookies;
cout<<"Enter the amount of sold cookies: "; cin>>soldCookies;
if (soldCookies >=20){
if (soldCookies < 30){
cout<<"Small Prize.";
}
else {
cout<<"Large Prize";
}
}
else {
cout<<"No prize";
}
return 0;
}
_________________________

#include <iostream>
using namespace std;
int main(){

int num;
cout<<"Enter a number: "; cin>>num;
switch (num){
case 1: cout<<"One";
break;
case 2: cout<<"Two";
break;
case 3: cout<<"Three";
break;
default: cout<<"Invalid number";
}

return 0;
}
________________________________
#include <iostream>
using namespace std;
int main(){

char letter;
cout<<"Enter letter: "; cin>>letter;
switch (tolower (letter)){
case 'a':
case 'e':
case 'i':
case 'o':
case 'u':
cout<<"This is vowel.";
break;
default: cout<<"This is not a vowel";
}

return 0;
}
___________________________________
#include <iostream>
using namespace std;
int main(){

int x = 0;
while (x < 10){
cout<<"Hello Granby!" <<endl;
x++;
}

return 0;
}
___________________
#include <iostream>
using namespace std;
int main(){

//13579
int x=1;
while (x < 10){
cout<<x <<endl;
x+=2;
}

return 0;
}
_________________

#include<iostream>
using namespace std;

int main(){

int power=3;
string answer;

while (power !=0){


cout<<"Who is the prettiest in section 1F? " << endl;
cout<<"Answer : ";
cin>>answer;

if (answer == "Abilong"){
cout<<"You're correct!";
break;
}
else {
power--;
}
if (power == 0)
{
cout<<"End game!!!!";
}
}
return 0;
}
________________________________

You might also like