Presentation is loading. Please wait.

Presentation is loading. Please wait.

COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

Similar presentations


Presentation on theme: "COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT"— Presentation transcript:

1 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
C++ CODES PART#12 COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

2 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

3 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
CONTINUE…. clrscr(); getname(); swapname(); getch(); } void getname() { COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

4 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

5 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
OUTPUT….. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

6 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

7 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
CONTINUE…. cout<<a<<endl<<s2<<endl; cout<<strlen(a)<<'\t'<<strcpy(s2,a); getch(); } COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

8 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
OUTPUT….. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

9 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

10 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
CONTINUE…. gotoxy(36,12); cout<<a; getch(); } COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

11 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
OUTPUT…. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

12 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

13 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
OUTPUT…. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

14 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

15 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
CONTINUE…. char str2[max]; strcpy(str2,str1); cout<<str2<<endl; getch();} COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

16 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
OUTPUT…. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

17 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

18 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
CONTINUE…. gets(c); gets(ch); cout<<strcpy(c,ch); getch();} COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

19 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
OUTPUT…. COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

20 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

21 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

22 COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT
OUTPUT… COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

23 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 ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT


Download ppt "COPY ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT"

Similar presentations


Ads by Google