skip to main | skip to sidebar

FUNDAMENTAL OF PROGRAMMING

Saturday, March 19, 2011

IF ELSE TO SWITCH CASE



if,,,else or switch case,,,depends on question

If else statement

#include
main ()
{
declare variable
int age;
//input
cout<<"enter your age =";
cin>>age;
//if..else statements
{ cout <<"your are child !";}
else if (age > = 7 ll age < = 12)
{ cout <<"you are teenager !";}
else if (age > = 22 ll age < = 30)
{cout <<"you are adult now!!";}
else if (age >30)
{ cout <<"you are old booooo.....";}
else
{cout<<"invalid selection";}
return o;
}

SWITCH CASE

#include
main ()
{
declare variable
int age;
//input
cout<<"enter your age =";
cin>>age;
switch..case statements
switch (age)
{ case ('age'> =1 ll age <= 6):cout<<"you are kids!";break;
case ('age'>=13 ll 'age' <= 12):cout<<"you are adult!";break;
case ('age'>=13 ll 'age'<=21):cout<<"you are teenager!";break;
case ('age'>= 22: ll 'age' <=30):cout<<"you are adult now!!";break;
case ('age'>=30):cout<<"you are old booooo.....";break;
default: cout<<"invalid selection";
}
return 0;
}
coret curhat karra mc'yudied at 7:35 PM

0 comments:

Post a Comment

thanks for comment..

Newer Post » « Older Post Home
Subscribe to: Post Comments (Atom)

MusicPlaylist
Music Playlist at MixPod.com

Followers

counters counters
counters
 stalkers reading

chit chakkks

Blog Archive

  • ▼  2011 (16)
    • ►  February (9)
    • ▼  March (7)
      • IF ELSE TO SWITCH CASE
      • LOOP AND WHILE
      • EXERCISE exam
      • EXERCISE 2
      • ASSIGNMENT 1
      • CORDING ASSIGNMENT 1
      • ASSIGNMENT 2

About Me

My photo
karra mc'yudied
stupid naive falling in love.. very sensitive n secretive.. love to be alone..
View my complete profile
Karra Mc'yudied II

Create your badge
Karra Mc'yudied

Create your badge

i heart u most

i heart u most
 
Copyright © FUNDAMENTAL OF PROGRAMMING. All rights reserved.
Blogger templates created by Templates Block
Wordpress theme by Uno Design Studio