COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT C++ CODES PART#12 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT SWAPING THE NAME #include<constream.h> #include <string.h> char name[100]; void getname(); void swapname(); void main() { COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT CONTINUE…. clrscr(); getname(); swapname(); getch(); } void getname() { COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT CONTINUE…. cout<<"Enter your name: "; cin>>name; } void swapname() { for(int i=strlen(name); i>=0; i--) cout<<name[i]; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT OUTPUT….. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Copying the string and finding length of the string #include<constream.h> #include<string.h> void main() { clrscr(); char a[]="SABA"; char s2[]="MUGHAL"; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT CONTINUE…. cout<<a<<endl<<s2<<endl; cout<<strlen(a)<<'\t'<<strcpy(s2,a); getch(); } COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT OUTPUT….. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT USING gotoxy #include<iostream.h> #include<conio.h> void main() { clrscr(); char a[100]="ENGR.SABA MUGHAL"; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT CONTINUE…. gotoxy(36,12); cout<<a; getch(); } COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT OUTPUT…. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
SIMPLE STRING VARIABLE #include<constream.h> void main(){ clrscr(); const int max=80; char a[max]; cout<<"enter a string:"; cin>>a; cout<<"you entered:"<<a<<endl; getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT OUTPUT…. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPYING THE STRING WITH EASY METHOD #include<constream.h> #include<string.h> void main() { clrscr(); char str1[]="ASSALAMUALAIKUM\n" "GOOD BYE"; const int max=80; // size of str2 buffer COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT CONTINUE…. char str2[max]; strcpy(str2,str1); cout<<str2<<endl; getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT OUTPUT…. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Using stdio.h and gets() #include<constream.h> #include<stdio.h> #include<string.h> void main(){ clrscr(); int a,b; char c[20],ch[20]; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT CONTINUE…. gets(c); gets(ch); cout<<strcpy(c,ch); getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT OUTPUT…. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
Find ASCII integer values of your name #include<constream.h> #include<stdio.h> #include<string.h> void main(){clrscr(); char c[20];int b,a; cout<<"enter any name"<<endl; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT CONTINUE…. gets(c); b=strlen(c); for(a=0;a<b;a++) { cout<<endl<<c[a]<<"="<<int(c[a]);} getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT OUTPUT… COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT NICE WORDINGS…. "Khush mizaji hamesha khoobsurti ki kami ko poora kr deti hai, Laykin Khoobsurti khush mizaji ki kami ko poora nahi kr sakti " COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT