1 / 35

C++ CODES PART#06

C++ CODES PART#06. Calculate area of a circle using a=pi*r*r. #include<iostream.h> #include<conio.h> void main() { clrscr(); float rad; const float pi=3.14159f; cout<<"Enter Radious :";. CONTINUE…. cin>>rad; float area=pi*rad*rad; cout<<"Area is :"<<area<<endl; getch(); }.

taima
Download Presentation

C++ CODES PART#06

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Calculate area of a circle using a=pi*r*r #include<iostream.h> #include<conio.h> void main() { clrscr(); float rad; const float pi=3.14159f; cout<<"Enter Radious :"; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  3. CONTINUE… cin>>rad; float area=pi*rad*rad; cout<<"Area is :"<<area<<endl; getch(); } COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  4. Output….. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  5. Do While loop #include<constream.h> void main() { clrscr(); int a; a=1; do COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  6. CONTINUE…. { cout<<a<<endl;a++; } while (a<11); getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  7. Output… COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  8. Using power function #include<constream.h> #include<math.h> void main() {clrscr(); int a,b,c; cout<<"enter the limit upto where you want the series"; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  9. Continue…. cin>>a; for(b=1;b<=a;b++) {c=pow(b,2); cout<<c<<" ";} cout<<"this series is the required one"; getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  10. Output… COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  11. Generate series as shown in the output… #include<constream.h> #include<math.h> void main() {clrscr(); int a,b,c; cout<<"enter limit"; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  12. Continue… cin>>a; for(b=1;b<=a;b++) {c=2*b*pow(-1,b); cout<<c<<" ";} cout<<"this series is the required one"; getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

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

  14. Generate series as shown in the output… #include<constream.h> #include<math.h> void main() {clrscr(); int a,b,c; cout<<"enter the last limit"; cin>>a; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  15. Continue…. for(b=1;b<=a;b++){ c=2*b*pow(-1,b+1); cout<<c<<" ";} cout<<"hence this is the required series"; getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

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

  17. Generate series as shown in the output… #include<constream.h> #include<math.h> void main() {clrscr(); int a,b,c; cout<<"enter the last limit"; cin>>a; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  18. Continue….. for(b=0;b<=a;b++) {c=pow(3,b); cout<<c<<" ";} cout<<"this series is the required one"; getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

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

  20. While loop #include<constream.h> void main() {clrscr(); int n; while(n!=0) cin>>n; cout<<endl; getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  21. Output….. • User enters many numbers when he/she enters zero so program terminates COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  22. Generate series as shown in output using while loop #include<constream.h> #include<math.h> void main() { clrscr(); int a,b,r; cout<<"plz enter your limit"; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  23. Continue…. cin>>b; a=1; while(a<=b) {r=2*a*pow(-1,a+1); cout<<r<<" "; a++;} getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  24. Output….. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  25. Generate series as shown in output using while loop #include<constream.h> #include<math.h> void main() {clrscr(); int a,b,r; cout<<"enter limit"; cin>>b; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  26. Continue…. a=0; while(a<b) {r=pow(3,a); cout<<r<<" "; a++;} getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  27. Output…. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  28. Generate series as shown in output using while loop #include<constream.h> #include<math.h> void main() { clrscr(); int a,b,r; cout<<"enter the limit"; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  29. Continue… cin>>b; a=1; while (a<=b) {r=pow(a,2); cout<<r<<" "; a++;} getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  30. Output….. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  31. Do-while loop #include<constream.h> void main() {clrscr(); long dividend,divisor; char ch; do { COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  32. Continue… cout<<"enter dividend:"; cin>>dividend; cout<<"enter divisor:"; cin>>divisor; cout<<"quotient is "<<dividend/divisor; COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  33. Continue…. cout<< " , remainder is "<<dividend%divisor; cout<<" \n do another?(y/n):"; cin>>ch;} while (ch!='n'); getch();} COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  34. Output….. COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

  35. CONCLUSION • NICE WORDINGS…. • It is more difficult to stay on top than to get there. The secret of success is that we never, never give up • Barish ka Qatra Seepi or Sanp dono kay Munah mein girta hai Jab keh Sanp ussay Zehar bana deta hai aur Seep Usay Moti. Jis ka jaisa "Zarf" waisi Uss ki "Takhleeq". COPY RIGHT@ ENGR.SABA MUGHAL FROM COMPUTER SYSTEMS DEPARTMENT

More Related