Documente Academic
Documente Profesional
Documente Cultură
#include<stdio.h>
#include<conio.h>
void main ()
{
clrscr();
int a[2][3];
int i,j;
printf("\n enter the value of matrix ");
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("\n The matrix is \n");
for(i=0;i<2;i++)
{
for (j=0;j<3;j++)
{
printf("\t%d",a[i][j]);
printf(" ");
}
printf("\n");
}
printf("\n The transpose of matrix is \n ");
for(j=0;j<3;j++)
{
for(i=0;i<2;i++)
{
printf("\t%d",a[i][j]);
printf(" ");
}
printf("\n");
}
getch();
}
//Program to print the sum of even & odd terms using GOTO
#include<iostream.h>
#include<conio.h>
void main()
{
int n,c=0,se=0,so=0,m;
clrscr();
cout<<"\nEnter no. of terms:";
cin>>n;
k:
c=c+1;
cout<<"\nEnter numbers:";
cin>>m;
if(m%2==0)
se=se+m;
else
so=so+m;
if(c<n) goto k;
cout<<"\nSum of even num is:"<<se;
cout<<"\nsum of odd num is:"<<so;
getch();
}
return 0;
");
");
");
");
");
if(j==5)// option 3
cout<<"3";
if(j==6)// option 4
cout<<"4";
if(j==7)// option 5
{
delay(300);
exit(0);
}
break;
}
}
textcolor(15);
textbackground(0);
}
case7();
getch();
break;
case 'P':
if(j>=yu+6)
{
gotoxy(47,5);
textcolor(BLUE);
cprintf("%d",1);
textcolor(15);
i=25;
gotoxy(i,j++);
textbackground(BLACK);
cprintf("
j=7;
gotoxy(i,j);
textbackground(num);
cprintf("
goto got;
}
gotoxy(47,5);
textcolor(BLUE);
cprintf("%d",j-5);
textcolor(15);
gotoxy(i,j++);
textbackground(BLACK);
cprintf("
gotoxy(i,j);
textbackground(num);
cprintf("
break;
case '8':
exit(0);
break;
case 'H':
gotoxy(47,5);
textcolor(BLUE);
cprintf("%d",j-7);
textcolor(15);
if(j<=7)
{
gotoxy(47,5);
textcolor(BLUE);
cprintf("%d",yu);
textcolor(15);
gotoxy(i,j--);
textbackground(BLACK);
cprintf("
j=yu+6;
gotoxy(i,j);
textbackground(num);
cprintf("
goto got;
}
gotoxy(i,j--);
textbackground(BLACK);
");
");
");
");
");
");
cprintf("
gotoxy(i,j);
textbackground(num);
cprintf("
break;
case 13:
textcolor(15);
textbackground(0);
gotoxy(10,10);
if(j==7)// option 1
case1();
if(j==8)// option 2
case2();
if(j==9)// option 3
case3();
if(j==10)// option 4
case4();
if(j==11)// option 5
case5();
if(j==12)
case6();
if(j==13)
{
exit(0);
}
break;
}
}
textbackground(0);
}
");
");
else days_month+=30;
}
days_tdays=0;
for(i=1;i<tm;i++)
{
if (i==1 || i==3 || i==5 || i==7 || i==8 || i==10 || i==12)
days_tdays+=31;
else if (i==2)
days_tdays+=28;
else days_tdays+=30;
}
tm=rem_years*365;
tt=tm+(days_month+days_tdays+td+days-d);
clrscr();
for(i=0;i<=tt;i++)
{
delay (1);
gotoxy (40,12);
cout<<i;
}
for (i=0;i<10;i++)
{
delay (100);
gotoxy(41,13) ;
cout<<" Days! is your Age...";
delay (100);
gotoxy(41,13);
cout<<"
";
}
getch();
}
break;
}
i++;
}
cout<<l;
getch();
}
public:
hh,
mm,
ss;
time()
{
hh = mm = ss = 0;
cout<<"\n CONSTRUCTOR CALLED ....";
}
~time()
{
cout<<"\n DESTRUCTOR CALLED
}
void display();
};
void time::display()
{
cout<<"\n DISPLAY DEFAULT TIME :::";
cout<<hh<<":"<<mm<<":"<<ss;
}
void main()
{
clrscr();
time
t;
t.display();
}
....";
int
n,
prime;
public:
};
void getdata();
void result();
void num::getdata()
{
cout<<"\n ENTER THE NUMBER TO BE CHECKED ";
cin>>n;
for( int i = 2; i < sqrt(n); i++ )
{
if( n % i == 0 )
{
prime = 0;
}
}
}
void num::result()
{
if(prime)
cout<<n<<"\nIS A PRIME NUMBER ";
else
cout<<n<<"\n IS NOT A PRIME NUMBER";
}
void main()
{
clrscr();
getch();
num
n;
n.getdata();
n.result();
}
getch();
closegraph();
return 0;
i=0;
do
{
textcolor(15);
c=getch();
if(c==13)
{
textcolor(15);
break;
}
cout<<"*";
js[i]=c;
i++;
}while((c>=65&&c<=90)||(c>=97&&c<=122)&&(i<10));
textcolor(15);
}
//end of welcome()
void alarm()
{
fstream fin;
fin.open("pwd.txt",ios::in);
fin>>ps>>ans>>k;
fin.close();
sound(2000);
zz: clrscr();
textcolor(15+128);
void hide()
{
clrscr();
welcome();
strcpy(ps,js);
clrscr();
textcolor(15);
gotoxy(10,15);
cprintf(" Question: What is your Pet's name");
gets(ans);
gotoxy(10,18);
cprintf("Enter Keyword");
cin>>k;
}//end of hide
void chpw()
{
clrscr();
welcome();
fstream fin;
fin.open("pwd.txt",ios::in);
fin>>ps>>ans>>k;
fin.close();
fstream fout;
fout.open("pwd.txt",ios::out);
fout<<js<<'\t'<<ans<<'\t'<<k;
fout.close();
cout<<"\n\n\nPassword Changed";
getch();
}//end of chpw
void chan()
{
clrscr();
fstream fin;
fin.open("pwd.txt",ios::in);
fin>>ps>>ans>>k;
fin.close();
fstream fout;
cprintf(" Question: What is your Pet's name");
gets(ans1);
fout.open("pwd.txt",ios::out);
fout<<ps<<'\t'<<ans1<<'\t'<<k;
fout.close();
cout<<"\n\n\n\nAnswer Changed";
getch();
}//end of chan
void chky()
{
clrscr();
fstream fin;
fin.open("pwd.txt",ios::in);
fin>>ps>>ans>>k;
fin.close();
fstream fout;
gotoxy(10,15);
cout<<" Enter the Keyword";
cin>>k1;
fout.open("pwd.txt",ios::out);
fout<<ps<<'\t'<<ans<<'\t'<<k1;
fout.close();
cout<<"\n\n\nKeyword changed";
getch();
}//end of chky
void vwall()
clrscr();
fstream fin;
fin.open("pwd.txt",ios::in);
fin>>ps>>ans>>k;
fin.close();
textcolor(15);
gotoxy(10,10);
cout<<" Password ";
cout<<ps;
gotoxy(10,12);
cout<<" Answer ";
puts(ans);
// cout<<"\t"<<ans;
gotoxy(10,15);
cout<<" Keyword ";
cout<<k;
getch();
clrscr();
}//end of vwall
}x;//end of class
void main()
{
int a=0,b;
char ch;
textbackground(1);
fstream fout;
fstream fin;
fin.open("pwd.txt",ios::in);
if(fin==NULL)
{
fin.close();
x.welcome();
x.hide();
fout.open("pwd.txt",ios::out);
fout<<x.ps<<'\t'<<x.ans<<'\t'<<x.k;
fout.close();
main();
}//if ends here
qq:
x.welcome();
fflush(stdin);
fin>>x.ps>>x.ans>>x.k;
fin.close();
a++;
if(a>=3)
{
x.alarm();
}textbackground(1);
if(strcmp(x.ps,x.js)!=0 && a<3)
{
gotoxy(10,20);
textcolor(15+128);
cprintf("Password Incorrect...");
gotoxy(10,22);
textcolor(15);
cprintf("Do you want to answer the question(y-yes)");
ch=getche();
clrscr();
if(ch=='y' || ch=='Y')
{
textcolor(15);
gotoxy(10,10);
cprintf("Question: What Is Your Pet's Name");
cout<<"\n";
cprintf("Answer: ");
gets(x.ans1);
if(strcmp(x.ans,x.ans1)!=0)
x.alarm();
else goto s;
}//end of if
else goto qq;
}
else{
s:
clrscr();
gotoxy(35,10);
cout<<"CORRECT ENTRY";
gotoxy(38,12);
textcolor(15+BLINK);
cprintf("Welcome...");
textcolor(15);
gotoxy(10,20);
cout<<"Do you want to Enter in Setup (Press Enter) (n) to
exit ";
ch=getche();
if(ch=='n' || ch=='N')
{
fin.close();
textcolor(15+BLINK);
gotoxy(50,22);
cprintf(" A Programe By:");
gotoxy(60,23);
cprintf("Diveymaan");
getch();
exit(0);
}
do
{
clrscr();
textbackground(1);
textcolor(15);
cout<<"\n 1- To Change Password"
<<"\n 2- To Change Answer"
<<"\n 3- To Change Keyword"
<<"\n 4- To view Password ,answer, keyword"
<<"\n 5- Exit";
cout<<"\n";
cin>>b;
switch(b)
case 1:
x.chpw();
break;
case 2:
x.chan();
break;
case 3:
x.chky();
break;
case 4:
x.vwall();
break;
case 5:
fout.close();
fin.close();
textcolor(15+128);
gotoxy(50,20);
cprintf(" A Programe By");
gotoxy(55,21);
cprintf(" Arvind Gaba");
getch();
exit(0);
break;
default:
gotoxy(15,15);
cout<<"You Have Entered Wrong Option";
break;
}
} while(b!=5);
getch();
}
delay(800);
gotoxy(5,23);
for(i=0;i<3;i++)
cout<<by[i];
delay(400);
}
gotoxy(5,24);
for(i=0;i<13;i++)
{
cout<<namee[i];
delay(400);
}/* clean up */
getch();
for(i=0;i<80;i++)
{
for(int yt=0;yt<35;yt++)
{
delay(1);
gotoxy(i,yt);
cout<<" ";
}
}
closegraph();
return 0;
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a=1,i=0,j=0,k=5;
do
{
a=0,j=0;
i++;
do
{
j++;
cout<<" ";
}
while(j<i);
do {
cout<<"*";
a++;
}while(a<k);
k=k-2;
cout<<"\n";
}while(i<3);
i=3,k=3,j=0;
do
{
j=0,i--;
a=0;
do
{
j++;
cout<<" ";
}while(j<i);
do
{
a=a+1;
cout<<"*";
}while(a<k);
k=k+2;
cout<<"\n";
}while(i>1);
getch();
}
if(ch==13)
{
text[counter]='*';
counter++;
ii[j]=i;
cout<<"\n";
j++;
i=0;
goto top;
}
if(ch==8)
{
text[--counter]=NULL;
gotoxy(--i,j);
cout<<" ";
if(i==0)
{
if(j==1)
goto top;
i=ii[--j]-1;
goto top;
}
if(i>0)
i--;
goto top;
}
if(ch=='$')
{
//puts(text);
//getch();
exit(0);
}
text[counter]=ch;
counter++;
}
}
}
midx = getmaxx() / 2;
midy = getmaxy() / 2;
setcolor(getmaxcolor());
/* draw arc */
getch();
textcolor(5);
for(int ii=220;ii>=0;ii--)
{
arc(300,200,ii,360,150);
delay(20);
}
for(ii=220;ii>=0;ii--)
{
for(int jj=145;jj>=5;jj-=5)
arc(300,200,ii,360,jj);
delay(5);
}
/* clean up */
getch();
closegraph();
return 0;
}
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<string.h>
#include<dos.h>
void main()
{
clrscr();
for(int i=0;i<10;i++)
{
delay(10);
gotoxy(30,12);
cout<<"Arvind Gaba";
delay(500);
gotoxy(30,12);
cout<<"
";
delay(10);
gotoxy(30,13);
cout<<"Arvind Gaba";
delay(500);
gotoxy(30,13);
cout<<"
";
delay(10);
gotoxy(30,14);
cout<<"Arvind Gaba";
delay(500);
gotoxy(30,14);
cout<<"
";
delay(10);
gotoxy(30,15);
cout<<"Arvind Gaba";
delay(500);
gotoxy(30,15);
cout<<"
";
delay(10);
gotoxy(30,16);
cout<<"Arvind Gaba";
delay(500);
gotoxy(30,16);
cout<<"
";
}
getch();
}
/* clean up */
closegraph();
cout<<"\n\n\nHY";
getch();
return 0;
}
for(i=1;i<30;i++)
{
delay(20);
gotoxy(i,11);
cout<<"WELCOME TO THE PROJECT";
gotoxy(i-1,11);
cout<<" ";
}
delay(200);
int
aa=1;
for(i=80;i>0;i--)
{
gotoxy(i,13);
delay(25);
cout<<" ";
gotoxy(aa,15);
delay(25);
aa++;
cout<<" ";
t:
}
for(i=78;i>=39;i--)
{
delay(25);
gotoxy(i,13);
cout<<"OF";
gotoxy(i+2,13);
cout<<" ";
}
delay(300);
gotoxy(30,15);
cout<<"THEATER MANAGEMENT.";
delay(300);
char ss[]={'B','Y','-'};
char name[]={'N','A','Z','M','A',' ','P','G','D','C','A'};
gotoxy(65,24);
for(i=0;i<3;i++)
{
delay(250);
cout<<ss[i]<<" ";
}
gotoxy(65,25);
for(i=0;i<11;i++)
{
delay(200);
cout<<name[i];
}
delay(300);
gotoxy(30,25);
cout<<"Press Any Key To Continue...";
getch();
int sss=50;
int g;
for(i=0;i<=25;i++)
{
for(int yj=0;yj<=80;yj++)
{
gotoxy(yj,i);
cout<<" ";
delay(3);}
}
for(int t=50;t<=75;t+=5)
{
for(int j=0;j<=500;j++)
{
line(t,0,t,j);//vertical
line(0,sss,g,sss);
//horizon
g+=2;
delay(1);
}
sss+=5;
g=0;
}
int uj;
for(i=410;i<=425;i+=5)
{
for(uj=350;uj<=600;uj++)
{
delay(1);
line(uj,i,uj,i);
}
}
for(i=510;i<=535;i+=5)
{
for(uj=325;uj<=450;uj++)
{
line(i,uj,i,uj);
delay(1);
}
}
getch();
closegraph();
return 0;
}
<stdio.h>
<conio.h>
<process.h>
<dir.h>
return 0;
//PROGRAM TO PRINT YOUR NAME AND DETAILS ON THE CENTER OF THE SCREEN//
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,c=35,r=40,s=36,w=38;
for(n=1;n<c;n++)
{
cout<<" ";
}
cout<<"ARVIND GABA";
cout<<"\n";
for(n=1;n<r;n++)
{
cout<<" ";
}
cout<<"12 SCI..";
cout<<"\n";
for(n=1;n<s;n++)
{
cout<<" ";
}
cout<<"COMPUTER PROJECT";
cout<<"\n";
for(n=1;n<w;n++)
{
cout<<" ";
}
cout<<"LETS PROCEED";
}
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
void main()
{
clrscr();
int i,j,k,n=39;
int c;
for(i=1;i<=9;i=i+2)
{
for(j=1;j<=n;j++)
{
cout<<" ";
}
for(k=1;k<=i;k++)
{
cprintf("*");
textcolor(90);
textbackground(1);
}
cout<<endl;
n=n-1;
getch();
}
}
#include<iostream.h>
#include<conio.h>
void main()
{
int i, n[10] ;
int p=0,o=0;
for(i=1;i<=10;i++)
{
cout<<"enter the num"<<endl;
cin>>n[i];
}
if(n[i]%2==0)
{
p=p+1;
}
else
{
o=o+1;
}
cout<<"the total; no of the odd num ="<<o<<endl;
cout<<"the total no of even num ="<<p<<endl;
getch();
}
//star design
*
**
***
****
*****
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
cout<<"*";
}
cout<<"\n";
}
getch();
}
//GIVEN DESIGN
I
II
III
IIII
IIIII
IIIIII
IIIIIII
IIIIIIII
IIIIIIIII
IIIIIIIIII
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j;
for(i=1;i<=10;i++)
{
for(j=1;j<=i;j++)
{
cout<<"I";
}
cout<<"\n";
}
getch();
}
//PROGRAM THAT INPUTS A SERIES OF NOS. FROM THE USER AND DISPLAYS BACK
THE SUM OF ALL THE ODDS AND EVEN NUMBERS
#include<iostream.h>
#include<conio.h>
void main()
{
int n,c=0,se=0,so=0,m;
clrscr();
cout<<"\nEnter no. of terms:";
cin>>n;
k:c=c+1;
cout<<"\nEnter numbers:";
cin>>m;
if(m%2==0)
se=se+m;
else
so=so+m;
if(c<n) goto k;
cout<<"\nSum of even num is:"<<se;
cout<<"\nsum of odd num is:"<<so;
}
sum
sub
mul
div
of
of
of
of
two
two
two
two
no
no
no
no
=%f",c);
=%f",d);
=%f",e);
=%f",f1);
//Program ENTER ANY INTEGER NO FROM THE KEYBOARD AND FIND WEATHER the
number entered is ARMSTORNG or not.
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n, i=1,c,x,sum=0,num;
cout<<"enter any no";
cin>>n;
num=n;
while(n>0)
{
x=n%10;
c=x*x*x;
sum=c+sum;
n=n/10;
}
if(num==sum)
cout<<"\nnois armstrong no";
else
cout<<"\nno is not arms";
getch();
// PROGRAM TO PRINT THE SUM OF THE EVEN NOS. UPTO ANY NO.
#include<iostream.h>
#include<conio.h>
void series (int n);
void main()
{
clrscr();
int k;
cout<<"enter the last limit";
cin>>k;
series (k);
}
void series (int n)
{
int i,s=0;
for (i=1;i<=n;i++)
s=s+i;
cout<<s;
getch();
}
// PROGRAM TO PRINT THE SUM OF THE NATURAL NOS. UPTO ANY NO.
#include<iostream.h>
#include<conio.h>
void series (int n);
void main()
{
int k;
cout<<"Enter the last limit "<<endl;
cin>>k;
series (k);
}
void series (int n)
{
int i,s=0;
for (i=1;i<=n;i++)
s=s+i;
cout<<"Sum= "<<s<<endl;
getch();
}
// PROGRAM TO PRINT THE SUM OF THE NATURAL NOS. UPTO ANY NO.
#include<iostream.h>
#include<conio.h>
void series (int n);
void main()
{
clrscr();
int k;
cout<<"enter the last limit";
cin>>k;
series (k);
}
void series (int n)
{
int i,s=0;
for (i=1;i<=n;i++)
s=s+i;
cout<<s;
getch();
}
// Program to except sale of each day of the week and print total sale
and average sale
#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int num[7] ;
int i,sum=0,aver;
cout<<"enter the 7 day's sale";
for(i=0;i<7;i++)
{
cin>>num[i];
sum=sum+num[i];
aver=sum/7;
}
cout<<"print average"<< aver;
getch();
}
";
// Program enter an string from keyboadr and find out its length
#include<iostream.h>
#include<conio.h>
main()
{
char i[100] ;int len ;
clrscr();
cout<<"enter the character";
cin>>i;
for(len=0;i[len]!='\0';len++);
cout<<"length number of character"<<len;
getch();
}
// Program to enter any string from the key board and copy into another
string
#include<iostream.h>
#include<conio.h>
#include<string.h>
main()
{
int len,i;
char str1[50],str2[50];
cout<<"enter the string";
cin>>str1;
for(i=0;str1[i]!='\0';i++)
{str2[i]=str1[i];}
str2[i]='\0';
cout<<str2;
getch();
}
for(int j=1;j<=a;j++)
printf("*");
for(int k=1;k<=b;k++)
printf(" ");
for(int l=1;l<=c;l++)
printf("*");
printf("\n");
a++;
if(i!=10)
b-=2;
if(i!=9)
c++;
}
getch();
}
#include<iostream.h>
#include<conio.h>
void main()
{ int count=2;
count=2;
while(count<=20)
{
cout<<count;
count=count+2;
}
getch();
}
// Program to find the sum of all even and odd numbers in an array.
#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int num[5],i,se=0,so=0;
cout<<"enter the 5 number";
for(i=0;i<5;i++)
{
cin>>num[i];
}
for(i=0;i<5;i++)
{
if(num[i]%2==0)
se+=i;
else
so+=i;
}
cout<<"the sum of even is:"<<se;
cout<<endl<<"the sum of odd is-----" <<so;
getch();
}
// Program enter a
#include<iostream.h>
#include<conio.h>
int fac(num)
{
int f=1,t;
while(num>0)
{
f=f*num;
num--;
}
return(f);
}
void main()
{
int num,e;
clrscr();
cout<<"Enter the number to get factorial";
cin>>num;
e=fac(num);
cout<<e;
getch();
}
// Program to enter two numbers and find the greatest one using function
#include<iostream.h>
#include<conio.h>
int comp(int,int);
void main()
{
int num1,num2,d;
cout<<"enter two value";
cin>>num1>>num2;
d=comp(num1,num2);
cout<<d;
getch();
}
int comp(int n1,int n2)
{
if(n1>n2)
return(n1);
else
return(n2);
}
// Program to enter the four side of a rectangle and find out weather
its area is greater than its perimeter
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,area,per;
cout<<"please enter the value of a";
cin>>a;
cout<<"please enter the value of b";
cin>>b;
area=a*b;
per=2*(a+b);
if (area>per)
{
cout<<"area is greater than per"<<area ;
}
else
cout<<"area is less than per";
getch(); }
// Program to make computer play the KBC game with the user
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<string.h>
#include<stdio.h>
void design();
void input();
void process();
void main()
{
clrscr();
int c=0;
design();
input();
process();
if(c!=5)
{
clrscr();
textcolor(4);
gotoxy(40,12);
cprintf("SORRY WRONG ANSWER");
getch();
}
}
void design()
{
cout<<'\a';
int i,j;
for(i=0;i<320;i++)
{
textcolor(1);
cprintf ("*");
}
for(j=0;j<25;j++)
{
textcolor(4);
gotoxy(1,j);
cprintf("*");
textcolor(4);
gotoxy(80,j);
cprintf("*");
delay(50);
}
delay(100);
textcolor(2);
gotoxy(30,12);
cprintf("KAUN BANEGA GA CROREPATI");
}
void input()
{
textcolor(14);
gotoxy(30,14);
cprintf("COMPUTER BACHHAN WILL ASK YOU 5 QUESTION");
textcolor(14);
gotoxy(30,15);
if(ch!=4)
{
goto k;
}
else
{
c=c+1;
textcolor(1);
gotoxy(20,7);
cprintf("QUESTION NO 4:");
textcolor(1);
gotoxy(20,10);
cprintf("AMITABH BACHHANS HOUSE IS KNOWN AS");
textcolor(1);
gotoxy(20,12);
cprintf("(A) SEA WINGS (B) KAMMANA (C)PRATIKSHA (D) ABCL HOUSE");
cin>>ch;
}
if(ch!=3)
{
goto k;
}
else
{
c=c+1;
textcolor(4);
gotoxy(20,7);
cprintf(" QUESTION NO 5");
textcolor(1);
gotoxy(20,10);
cprintf("IN 1736 WHICH CENTURY WAS IT");
textcolor(1);
gotoxy(20,12);
cprintf("(A)18 (B) 12 (C) 56 (D) 78");
cin>>ch;
}
if(ch!=1)
c=c+1;
k:
}
// Program to find the number is equal , greater or less than the other
number
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int num1,num2;
cout<<"please enter two number";
cin>>num1>>num2;
if(num1>num2)
cout<<"num1 is greater then"<<num1;
else
{
if(num2>num1)
cout<<"num2 is ___"<<num2;
else
cout<<"is equal"<<num1;
}
getch();
}
from 10-100
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
void main()
{
clrscr();
long int i,d,n,s=0,r,old,p;
cout<< "armstrong number fron 10 to 1000 are as follows: \n";
for(p=10;p<=1000;p++)
{
s=0;
old=n=p;
do
{
d=n%10;
r=d*d*d;
s+=r;
n=n/10;
}while(n!=0);
if(old==s)
cout<<old<<" ";
}
getch();
}
// Programe which will ask you to enter the marks of four subject
display the total and the persantage
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
float a,b,c,d,e;
cout<<"enter the marks in four subject";
cin>>a>>b>>c>>d;
e=a+b+c+d;
cout<<"the total is"<<e;
float f;
f=(e*100)/400;
cout<<"the percentage is"<<f;
getch();
}
//revers function
#include<iostream.h>
#include<conio.h>
#include<string.h>
main()
{
clrscr();
char str1[10],str2[10];
cout<<"enter the value";
cin>>str1;
strrev(str1);
cout<<str1;
getch();
}
// Program enter any integ no from keyboard and find the number is
storng or not
#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
long num,rem,fact=1,sum=0,z ,n;
cout<<"ENTER ANY DABBA NUMBER";
cin>>num;
z=num;
while(num>0)
{
n=num%10;
fact=1;
while(n>0)
{
fact=fact*n;
n--;
}
sum=sum+fact;
num=num/10;
}
if(z==sum)
cout<<"THE NUMBER IS AS STRONG AS ME";
else
cout<<"THE NUMBER IS NOT STRONG LIKE YOU";
getch();
}
int x[5],total,i;
float avg;
for(i=0;i<5;i++)
{
}
}
monday ";
tuesday ";
wednessday ";
thursday ";
friday ";
";
// Program to count the number of empoly earning more than 1lack. per
annum.the monthly salary of 10 employ are input through key board
#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
long sal[10];
long i=0,c=0,anual
;
cout<<"enter the 10 empoly salary per month";
for( i=0;i<10;i++)
cin>>sal[i];
{
anual=sal[i]*12;
}
if(anual>100000)
c++;
cout<<c ;
getch();
}
total=total+amt[sno];
sno++;
cout<<"Do you want to continue(Y/N) ";
ch=getch();
}
void p()
{
pu();
cout<<"";
\n";
for(int i=1;i<78;i++)
cout<<"";
cout<<"\n";
cout<<"
P U N E E T PROVISIONAL STORES PVT. LTD.
cout<<"
PGDCA , SESSION:2001-2002, TMIMT Delhi
Road, Moradabad
\n";
cout<<"
Phone no.: 318401,Fax no. :484244,Mobile
no.:983713231
\n";
cout<<"";
for(i=1;i<78;i++)
cout<<"";
cout<<"\n";
cout<<"\n\n";
}
void base::show()
{
void p();
p();
cout<<"\t\t\t\t B I L L\n";
for(i=1;i<78;i++)
cout<<"";
cout.width(1);
cout.setf(ios::internal);
cout<<"\nSno";
cout.width(20);
cout.setf(ios::right);
cout<<"Product name";
cout.width(15);
cout.setf(ios::internal);
cout<<"Quanity";
cout.width(15);
cout.setf(ios::internal);
cout<<"Unit price";
cout.width(20);
cout.setf(ios::internal);
cout<<"Amount";
cout<<"\n";
for(i=1;i<78;i++)
cout<<"";
}
void base::line()
{
}
void base::display()
for(int i=1;i<sno;i++)
{
cout<<endl;
cout.width(2);
cout.setf(ios::internal);
cout<<i;
cout.width(20);
cout.setf(ios::internal);
cout<<qname[i];
cout.width(12);
cout.setf(ios::internal);
cout<<qty[i];
cout.width(12);
cout.setf(ios::internal);
cout<<up[i];
cout.width(24);
cout.setf(ios::internal);
cout<<amt[i];
}
cout<<"\n";
for(i=1;i<78;i++)
cout<<"";
cout<<"\n";
cout.width(2);
cout.setf(ios::internal);
cout<<"TOTAL Amount in Rupees:";
cout.width(47);
cout.setf(ios::internal);
cout<<total;
cout<<"\n";
for(i=1;i<78;i++)
cout<<"";
cout<<"\n\n";
cout<<"Thank you for your Kind Visit, Please Visit us again ";
}
void main()
{
clrscr();
pu();
int i=30;
gotoxy(i,8);
delay(400);
cout<<"W";
gotoxy(i+=2,8);
delay(400);
cout<<"E";
gotoxy(i+=2,8);
delay(400);
cout<<"L";
gotoxy(i+=2,8);
delay(400);
cout<<"C";
gotoxy(i+=2,8);
delay(400);
cout<<"O";
gotoxy(i+=2,8);
delay(400);
cout<<"M";
gotoxy(i+=2,8);
delay(400);
cout<<"E";
i=33;
gotoxy(i+=2,9);
delay(400);
cout<<"T";
gotoxy(i+=2,9);
delay(400);
cout<<"O";
i=32 ;
gotoxy(i+=2,10);
delay(400);
cout<<"T";
gotoxy(i+=2,10);
delay(400);
cout<<"H";
gotoxy(i+=2,10);
delay(400);
cout<<"E";
i=28;
gotoxy(i+=2,11);
delay(400);
cout<<"P";
gotoxy(i+=2,11);
delay(400);
cout<<"R";
gotoxy(i+=2,11);
delay(400);
cout<<"O";
gotoxy(i+=2,11);
delay(400);
cout<<"J";
gotoxy(i+=2,11);
delay(400);
cout<<"E";
gotoxy(i+=2,11);
delay(400);
cout<<"C";
gotoxy(i+=2,11);
delay(400);
cout<<"T";
i=33;
gotoxy(i+=2,12);
delay(400);
cout<<"O";
gotoxy(i+=2,12);
delay(400);
cout<<"N";
gotoxy(i+=2,12);
delay(400);
i=27;
gotoxy(i+=2,13);
delay(400);
cout<<"S";
gotoxy(i+=2,13);
delay(400);
cout<<"U";
gotoxy(i+=2,13);
delay(400);
cout<<"P";
gotoxy(i+=2,13);
delay(400);
cout<<"E";
gotoxy(i+=2,13);
delay(400);
cout<<"R";
gotoxy(i+=2,13);
delay(400);
gotoxy(i+=2,13);
delay(400);
cout<<"M";
gotoxy(i+=2,13);
delay(400);
cout<<"A";
i= 30 ;
gotoxy(i+=2,14);
delay(400);
cout<<"R";
gotoxy(i+=2,14);
delay(400);
cout<<"K";
gotoxy(i+=2,14);
delay(400);
cout<<"E";
gotoxy(i+=2,14);
delay(400);
cout<<"T";
gotoxy(i+=2,14);
delay(400);
cout<<"E";
(25,18);
delay(400);
cout<<"~~~~~~~~~~~~~~~~~~~~~~~";
delay(700);
gotoxy(60,23);
cout<<"By:Arvind Gaba
";
getch( );
pu();
clrscr();
base b;
b.get();
clrscr();
b.show();
b.display();
b.line();
getch();
}
// program which will ask you to enter two integer from the keyboard
and display its sum
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
cout<<"please enter the value a";
cin>>a;
cout<<"please enter the value b";
cin>>b;
c=a+b;
cout<<"the total value is"<<c;
getch();
}
// program to print the memory location before and after the increment
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x;
int*pointer;
x=10;
pointer=&x;
cout<<"Memory location before incrementation =";
cout<<pointer;
pointer++;
cout<<endl;
cout<<"Memory location after incrementation =";
cout<<pointer;
getch();
}
//
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
char ch;
cout<<"enter any c haracter";
cin>>ch;
switch(ch)
{
case'a':
case'A':
case'e':
case'E':
case'i':
case'I':
case'o':
case'O':
case'u':
case'U':
cout<<"it is a vowel:"<<ch;
break;
default:
cout<<"it is a consonent";
}
getch();
}
operator float()
{
float fracfeet= inches/12;
fracfeet+=float(feet);
return(fracfeet/MTF);
}
};
void main()
{
clrscr();
distance dist1=2.34;
cout<<"\nDist1 = ";
dist1.showlist();
cout<<"\nDist1 = ";
dist1.showlist();
distance dist2 = (5,10.25);
float mtrs=float(dist2);
cout<<"\nDist2 = "<<mtrs <<"metres";
mtrs=dist1;
cout<<"\nDist1 = "<<mtrs <<"metres";
getch();
}
m[i][j]=m[i][j]+(a[i][k]+b[k][j]);
}
display(m,n);
}
void display(int m[][MAX],int n)
{
cout<<"Multiplication Of Matrixes Is\n";
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<"\t"<< m[i][j];
}
cout<<"\n";
}
}
}
}
for(int j=0;j<n;j++)
{
cout<<a[i][j]<<"\t";
}
cout<<"\n";
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
char ones[9][10]={"one", "two", "three", "four", "five", "six",
"seven",
"eight", "nine"};
char tens[10][10]={"ten, eleven", "twelve", "thirteen",
"fourteen",
"fifteen", "sixteen", "seventeen",
"eighteen", "nineteen"};
char etc[8][10]={"twenty", "thirty", "forty", "fifty", "sixty",
"seventy",
"eighty", "ninety"};
long int num;
int a[10], i=0, temp, j;
do
{
clrscr();
cout<<"\n Enter any number (<100) : ";
cin>>num;
}while(num>=100);
int s = num;
do
{
a[i++]=num%10;
num = num/10;
}while(num!=0);
i--;
if(i==0)
{
cout<<ones[--s];
}
else
if(i==1&&a[i]==1)
{
temp = a[0];
cout<<tens[temp];
}
else
if(i==1)
{
temp = a[1];
temp-=2;
cout<<etc[temp];
if(a[0]!=0)
{
temp = a[0];
cout<<" "<<ones[--temp];
}
}
}
getch();
exit(0);
}
}
default:
cout<<"\n Wrong Choice";
#include<iostream.h>
#include<conio.h>
enum result{y,n};
class distance
{
int feet;
float inch;
public:
distance()
{
feet=0;
inch=0;
}
distance(int f,float i)
{
feet=f;
inch=i;
}
void getdata()
{
cout<<"\nEnter The Values (Feet & Inches):
cin>>feet>>inch;
}
void showdata()
{
cout<<"\nFeets Are: "<<feet;
cout<<"\nInches Are: "<<inch;
}
result operator< (distance d)
{
inch=inch+(feet*12);
d.inch=d.inch+(d.feet*12);
if(inch<d.inch)
return y;
else
return n;
}
};
void main()
{
clrscr();
distance dist1(10,8.5);
distance dist2;
";
dist2.getdata();
dist1.showdata();
dist2.showdata();
if((dist1<dist2)==result(0))
cout<<"\nDist1 is less";
else
cout<<"\nDist2 is less";
getch();
}
#include<iostream.h>
#include<conio.h>
class distance
{
int feet;
float inches;
public:
void setdata(int f,float i)
{
feet=f;
inches=i;
}
void getdata()
{
cout<<"\nEnter Feet: ";
cin>>feet;
cout<<"\nEnter Inches: ";
cin>>inches;
}
};
void display()
{
cout<<"\nFeet Are: "<<feet;
cout<<"\nInches Are: "<<inches;
}
void main()
{
clrscr();
distance d1,d2;
d1.setdata(12,5.6);
d2.getdata();
d1.display();
d2.display();
getch();
}
void operator=(counter m)
{
a = m.a;
b = m.b;
}
void main(void)
{
counter c1(10,2.506);
counter c2(9,5.908);
clrscr();
cout<<"\nInitial Values are : ";
c1.display();
c2.display();
c2.operator=(c1);
cout<<"\nFinal Values : ";
c2.display();
getch();
}
void main()
{
clrscr();
distance dd1, dd2, dd3;
dd1.getdata(10, 11.256);
dd2.getdata(11, 10.956);
dd1.showdata();
dd2.showdata();
dd3.add_obj(dd1,dd2);
dd3.showdata();
getch();
void deposit()
{
int d;
cout<<"\nEnter the amount to be deposited : ";
cin>>d;
bal += d;
}
void withdrawl()
{
int d;
cout<<"\nEnter the amount to be withdrawn : ";
cin>>d;
if(bal<d)
cout<<"\n\nU don't have so much amount in UR account..";
else
{
bal -= d;
cout<<"\nAmount balance : "<<bal;
}
void display()
{
cout<<"\nName is
cout<<"\nAccount
cout<<"\nAccount
cout<<"\nBalance
: "<<name;
number : "<<acc;
type ; "<<type;
is : "<<bal;
};
void main()
{
clrscr();
bank b;
b.getamount();
b.deposit();
b.withdrawl();
b.display();
getch();
}
}
d1.feet+=feet-d.feet;
return d1;
};
void main()
{
clrscr();
distance dist1,dist2,dist3;
dist1.getdata(12,5.6);
dist2.getdata(10,4.4);
dist1.showdata();
dist2.showdata();
dist3=dist1+dist2;
dist3.showdata();
dist3=dist1-dist2;
dist3.showdata();
getch();
}
// Program to generate a Structures named Phone & insert data into it.
# include <iostream.h>
# include <conio.h>
struct phone
{
int acode;
float ecode;
char no;
}m,n;
void main()
{
clrscr();
m.acode = 91;
m.ecode = 591;
m.no = 249;
cout<<"Area Code : "<<m.acode<<endl;
cout<<"Exchange Code : "<<m.ecode<<endl;
cout<<"Phone No. : "<<m.no;
cout<<"\nInsert NOW";
cout<<"Enter the Area Code : ";
cin>>n.acode;
cout<<"Enter the Exchange Code : ";
cin>>n.ecode;
cout<<"Enter the Phone No. : ";
cin>>n.no;
cout<<"Area Code : "<<n.acode<<endl;
cout<<"Exchange Code : "<<n.ecode<<endl;
cout<<"Phone No. : "<<n.no;
}
// Program to check that entered year is a LEAP and SUPER year or NOT.
# include <iostream.h>
# include <conio.h>
void main()
{
int y;
clrscr();
cout<<"Enter Any Year " ;
cin>>y;
if ((y%4==0)&&(y%400!=0))
cout<<"\n Enterd year is a LEAP YEAR ONLY";
else if ((y%4==0)&&(y%400==0))
cout<<"\n Enterd year is a LEAP & SUPER YEAR both";
else
cout<<"\n Enterd year is not a LEAP YEAR ";
getch();
}
cout<<endl;
getch();
}
# include <iostream.h>
# include <conio.h>
inline float convert (int k)
{
int m;
m = k * 1000;
return m;
}
void main()
{
int km,mt;
clrscr();
cout<<"Enter the distance in Kms. : ";
cin>>km;
mt = convert(km);
cout<<endl<<"Distance in Meters are : "<<mt;
getch();
}
xco=0;
yco=0;
}
rec(float x,float y)
{
xco=x;
yco=y;
}
dispaly()
{
cout<<"\nValue Of X: "<<xco;
cout<<"\nValue Of Y: "<<yco;
}
};
class polar
{
float radius;
float angle;
public:
polar()
{
radius=0.0;
angle=0.0;
}
polar(float r,float a)
{
radius=r;
angle=a;
}
display()
{
cout<<"\nRadius Is: "<<radius;
cout<<"\nAngle Is : "<<angle;
}
operator rec()
{
float x=radius*cos(angle);
float y=radius*sin(angle);
return rec(x,y);
}
};
void main()
{
clrscr();
polar p(10,.78);
rec r;
r=p;
r.dispaly();
p.display();
getch();
}
if(c1==c2)
cout<<"Equal";
else
cout<<"Not Equal";
counter c3;
c1*c2;
c1.putcount();
getch();
}