• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this document? Why not share!

Program(Output)

on

  • 1,064 views

 

Statistics

Views

Total Views
1,064
Views on SlideShare
1,022
Embed Views
42

Actions

Likes
1
Downloads
0
Comments
0

1 Embed 42

http://mapsrohini.blogspot.com 42

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Program(Output) Program(Output) Document Transcript

    • /******************Program 1 *************** #include<iostream.h> void display(char *s) { for(int x=0;s[x]>0;x++) { for(int y=0;y<=x;y++) cout<<s[y]; cout<<endl; } } void main() { char *t="LAND"; display(t); } *****************Program 2 *************** #include<iostream.h> int &max (int &x,int &y) { if(x>y) return (x); else return (y); } void main()
    • { clrscr(); int A=10,B=13; max(A,B)=-1; cout<<"A= "<<A<<"B= "<<B<<endl; max(B,A)=7; cout<<"A= "<<A<<"B= "<<B<<endl; getch(); } *****************Program 3 *************** #include<iostream.h> #include<conio.h> int main() { clrscr(); char string[]="Pointers and strings"; cout<<*(&string[2])<<endl; cout.write(string+5,15).put('n'); cout<<*(string+3)<<'n'; getch(); return 0; } /* // *****************Program 4 *************** #include<iostream.h> #include<conio.h> int a=10; void main()
    • { void demo(int &,int,int*); int a=20,b=5; demo(::a,a,&b); cout<<::a<<a<<b<<endl; } void demo(int &x,int y,int *z) { a+=x; y*=a; *z=a+y; cout<<x<<y<<*z<<endl; } //*****************Program 5 *************** #include<iostream.h> #include<conio.h> #include<string.h> #include<ctype.h> void main() { char *S="ObjeCT"; int L=strlen(S); for(int C=0;C<L;C++) if(islower(S[C])) S[C]=toupper(S[C]);
    • else if(C%2==0) S[C]='E'; else S[C]=tolower(S[C]); cout<<"New message :"<<S; getch(); } //*****************Program 6 *************** #include<iostream.h> void Execute(int &x,int y=200) { int temp=x+y; x+=temp; if(y!=200) cout<<temp<<" "<<x<<" "<<y<<endl; } void main() { int a=50,b=20; Execute(b); cout<<a<<" "<<b<<endl; Execute(a,b); cout<<a<<" "<<b<<endl; }
    • //*****************Program 7 *************** #include<iostream.h> void print(char *p) { p="Pass"; cout<<"n Value is "<<p<<endl; } void main() { char *q="Best Of luck"; print(q); cout<<"n New value is "<<q; } //*****************Program 8 *************** #include<iostream.h> #include<conio.h> /*#include<string.h> #include<ctype.h> void main() { char *s="GOODLUCK"; for(int x=strlen(s)-1;x>0;x--) { for(int y=0;y<=x;y++) cout<<s[y]; cout<<endl;
    • } } //*****************Program 9 *************** #include<iostream.h> int a=3; void demo(int x, int y,int &z) { a+=x+y; z=a+y; y+=x; cout<<x<<" "<<y<<" "<<z<<endl; } void main() { int a=2,b=5; demo(::a,a,b); cout<<::a<<" " <<a<<" "<<b<<endl; demo(::a,a,b); } //*****************Program 10 *************** #include<iostream.h> int max(int &x,int &y,int &z) { if(x>y &&y>z) {
    • y++; z++; return x; } else if(y>x) return y; else return z; } void main() { int a=10,b=13,c=8; a=max(a,b,c); cout<<a<<b<<c<<endl; b=max(a,b,c); cout<<++a<<++b<<++c<<endl; } //*****************Program 11 *************** #include<iostream.h> #include<conio.h> #include<string.h> #include<ctype.h> void main() { clrscr(); int a=32,*X=&a;
    • char ch=65,&cho=ch; cho+=a; *X+=ch; cout<<a<<','<<ch<<endl; } //*****************Program 12 *************** #include<iostream.h> struct point { int x,y; }; void show(point p) { cout<<p.x<<';'<<p.y<<endl; } void main() { point U={0,10},V,W; V=U; V.x+=0; W=V; U.y+=10; U.x+=5; W.x-=5; show(U); show(V);
    • show(W); } //************** Program 13 *************** #include<iostream.h> void main() { int x[]={10,20,30,40,50}; int *p,**q; int *t; p=x; t=x+1; q=&t; cout<<*p<<','<<**q<<','<<*t++; } #include<iostream.h> #include<conio.h> #include<string.h> #include<ctype.h> class state { char *statename; int size; public: state()
    • { size=0; statename=new char[size+1]; } void display() { cout<<statename<<endl; } state(char *s) { size=strlen(s); statename=new char[size+1]; strcpy(statename,s); } void replace(state &a, state &b) { size=a.size+b.size; delete statename; statename=new char[size+1]; strcpy(statename,a.statename); strcat(statename,b.statename); } }; void main() { char *temp="Delhi"; state state1(temp),state2("mumbai"),state3("Nagpur"),S1,S2; S1.replace(state1,state2); S2.replace(S1,state3); S1.display(); S2.display();
    • } */ #include<iostream.h> #include<conio.h> #include<string.h> #include<ctype.h> void main() { clrscr(); long NUM=1234543; int f=0,s=0; do{ int rem=NUM%10; if(rem%2==0) f+=rem; else s+=rem; NUM/=10; }while(NUM>0); cout<<f-s; } /************** OUTPUT Program 1 *************** L LA LAN
    • LAND ************** OUTPUT Program 2 *************** A= 10B= -1 A= 7B= -1 ************** OUTPUT Program 3 *************** i ers and strings n ************** OUTPUT Program 4 *************** 20400420 2020420 ************** OUTPUT Program 5 *************** New message :EBJEEt ************** OUTPUT Program 6 *************** 50 240 290 340 240 340 240 22 ************** OUTPUT Program 7 *************** Value is Pass New value is Best Of luck ************** OUTPUT Program 8 *************** GOODLUCK GOODLUC GOODLU
    • GOODL GOOD GOO GO ************** OUTPUT Program 9 *************** 3 5 10 8 2 10 8 10 20 ************** OUTPUT Program 10 *************** 13138 1499 ************** OUTPUT Program 11 *************** 129,a ************** OUTPUT Program 12 *************** 5;20 0;10 -5;10 ************** OUTPUT Program 13 *************** 10,30,20 ************** OUTPUT Program 14 *************** Delhimumbai DelhimumbaiNagpur
    • ************** OUTPUT Program 15 *************** -2 */