Practical 2 B

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

/* PRACTICAL 2 B */

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

/* NAME : SAIRAJ BORAWAKE */

/* ENROLL NO : 2206017 */

/* DIVISION : G2 */

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

/* Use Control Structure in C++ */

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

#include<iostream.h>

#include<conio.h>

void main()

int a, i, j, k, num1, num2, num3, time, age;

char word[100];

clrscr();

cout<<"\nEnter : \n\n 1) FOR PRINTING A PATTERN \n 2) AGE VERIFICATION FOR VOTING \n 3)


FINDING GREATER NUMBER BETWEEN 2 NUMBERS \n 4) FOR PRINTING ONE WORD FOR FINITE
TIME\n 5) EXIT \n\n\n ";

cin>>a;

switch(a)

case 1:

for(i=0;i<6;i++)

for(j=6;j>i;j--)

cout<<" ";

for(k=0;k<=i;k++)
{

cout<<"$ ";

cout<<"\n";

break;

case 2 :

cout<<"\nENTER YOUR AGE : ";

cin>>age;

if(age>18)

cout<<"\nYOU CAN VOTE...!";

else{

cout<<"\nYOU CAN'T VOKE :(";

break;

case 3 :

cout<<"\nENTER TWO NUMBERS : ";

cin>>num1>>num2>>num3;

if(num1>num2)

if(num1>num3)

cout<<"\n"<<num1<<"IS A GREATEST NUMBER";

else{

cout<<"\n"<<num3<<"IS A GREATEST NUMBER";

}
else if(num2>num3)

cout<<"\n"<<num3<<"IS A GREATEST NYUMBER ";

else{

cout<<"\n"<<num2<<"IS AGREATEST NUMBER";

break;

case 4 :

cout<<"\nENTER THE WORD: ";

cin>>word;

cout<<"\n HOW MANY TIMES TO PRINT : ";

cin>>time;

for(i=0;i<=time;i++)

cout<<"\n"<<word;

break;

case 5:

cout<<"\nEXIT SUCCESSFUL....!!!";

break;

default: cout<<"\n INVALID OPTION....!!!";

getch();

You might also like