#include <iostream.h>
#include <stdio.h>
#include <conio.h>
void main() {
clrscr();
char chart [5][5] = { '0' , '0' , '0' , '0 ', '0' ,
'0' , '0' , '0' , '0' , '0' ,
'0' , '0' , '0' , '0' , '0' ,
'0' , '0' , '0' , '0' , '0' ,
'0' , '0' , '0' , '0' , '0' } ;
char ch[4] = { 'a' , 'b' , 'c' , 'd' } ;
cout << chart << endl ;
cout << ch ;
getch();
}
Eample 2:
#include <iostream.h>
#include <conio.h>
void main() {
clrscr();
int a[10] = {25,65,98,36,21,47,85,85,96,41};
int temp;
for(int i = 0;i<=9; i++)
{
for(int j=1;j<=9;j++)
if(a[i]>a[i+j]) {
temp=a[i];
a[i]=a[i+j];
a[i+j]=temp;
}
}
int *ptr = a;
for(i=1;i<=10;i++) {
cout<<*ptr<<endl;
ptr++;
}
getch();
}
Eample 3:
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
void main() {
clrscr();
char ac[10]={0,0,0,0,0,0,0,0,0,0},x=0,a=0;
gotoxy(10,10);cout<<"Enter Your Roll.No";
while(a!=13) {
a=getch();
if(a>=48&&a<=57&&x<10) {
cout<<(char)a;
ac[x]=a;
x++;
}
}
gotoxy(12,12);
for(int i=0;i<10;i++)
cout<<ac[i];
getch();
}
No comments:
Post a Comment