W.A.P. C++

WAP | CPP | Programs in C++ | C++ Solutions

Snehil Khanor's Binary Log

Write a program to find greatest of three numbers


Three numbers are taken from user and greatest number is displayed.
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. int a,b,c;
  7. cout<<"Please enter three nos. ";
  8. cin>>a>>b>>c;
  9. if (a>b)
  10. {
  11. if (a>c)
  12. cout<<"a is largest";
  13. else
  14. cout<<"c is largest";
  15. }
  16. //Coding by: Snehil Khanor
  17. //http://WapCPP.blogspot.com
  18. else if (b>c)
  19. cout<<"b is largest";
  20. else
  21. cout<<"c is largest";
  22. getch();
  23. }

Write a program to display seconds as Minutes and Hours and days


write a program that asks the user to enter a number of seconds. obeying the following conditions:
1. there are 60 seconds in a minute. if the number of seconds entered by the is greater than or equal to 60, the program should display the number of minutes in that many seconds.
2. there are 3600 seconds in an hour. if the number of seconds entered by a user is greater than or equal to 3600, the program should display the number of hours in that many seconds.
3. there are 86400 seconds in a day, if the number of seconds entered by the user is greater than or equal to 86400, the program should display the number of days in that many seconds,
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. float secs,mins,hours,days;
  7. cout<<"Enter no. of seconds: ";
  8. cin>>secs;
  9. //Coding by: Snehil Khanor
  10. //http://WapCPP.blogspot.com
  11. mins=secs/60;
  12. hours=secs/3600;
  13. days=secs/86400;
  14. if (secs>=60 && secs<3600)
  15. cout<<"No. of Minutes= "<<mins;
  16. else if (secs>=3600 && secs<86400)
  17. cout<<"No. of Hours= "<<hours;
  18. else if (secs>=86400)
  19. cout<<"No. of Days= "<<days;
  20. else
  21. cout<<"No.of seconds= "<<secs;
  22. getch();
  23. }

Write a program to insert number of days from user and calculate number of weeks and remaining days


Number of days is taken from user and number of weeks and remaining days are given as output.
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. int n,d,w;
  7. cout<<"enter Number of days u have:. ";
  8. cin>>n;
  9. //Coding by: Snehil Khanor
  10. //http://WapCPP.blogspot.com
  11. w=n/7;
  12. d=n%7;
  13. cout<<"No.of weeks= "<<w;
  14. cout<<"\nno. of days= "<<d;
  15. getch();
  16. }

Write a program to calculate sum of two numbers


Two numbers are taken from the user and sum is calculated.
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. float a,b,s;
  7. cout<<"Please enter a no.: ";
  8. cin>>a;
  9. //Coding by: Snehil Khanor
  10. //http://WapCPP.blogspot.com
  11. cout<<"Please enter another no.: ";
  12. cin>>b;
  13. s=a+b;
  14. cout<<"The sum is: "<<s;
  15. getch();
  16. }

Write a program to display the input


This is an ideal first program for learning "cin"
Two numbers are taken from the user and then displayed as output.
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. int a,b;
  7. cout<<"enter first no. ";
  8. cin>>a;
  9. //Coding by: Snehil Khanor
  10. //http://WapCPP.blogspot.com
  11. cout<<"enter second no. ";
  12. cin>>b;
  13. cout<<"First no. is "<<a;
  14. cout<<"\nSecond no.is "<<b;
  15. getch();
  16. }

Write a program to output a messege (without description)


If the Previous post scares you.. then heres the code without description.. :)
This is an ideal first program.
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. //Coding by: Snehil Khanor
  7. //http://WapCPP.blogspot.com
  8. cout<<"Hello India";
  9. cout<<"\nThis is my first C++ programme";
  10. getch();
  11. }

Write a program to output a messege


This is an ideal First C++ (CPP) program.
All necessary things are described with in the program in comments.
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include <iostream.h> //These are the Header files and are essential..
  2. #include <conio.h> // They varies program to program.
  3. void main() //This is a special type of function.Program starts and ends in MAIN.
  4. {
  5. //Coding by: Snehil Khanor
  6. //http://WapCPP.blogspot.com
  7. clrscr(); //This clears previous outputs from the output screen
  8. cout<<"Hello India"; //This is responsible for diplaying a messege
  9. cout<<"\nThis is my first C++ programme";
  10. getch(); //This helps to sustain the output on Screen.
  11. }

Write a program to find Simple interest


Principal ammount, rate of Interest and time period is Taken from user and Simple Interest is calculated.
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. float p,r,t,f,s=0;
  7. cout<<"Please enter Principle ammount ";
  8. cin>>p;
  9. //Coding by: Snehil Khanor
  10. //http://WapCPP.blogspot.com
  11. cout<<"Please enter rate of Interest. ";
  12. cin>>r;
  13. cout<<"Please enter Time Period ";
  14. cin>>t;
  15. f=p*r*t;
  16. s=f/100;
  17. cout<<"The Simple iterest is "<<s;
  18. getch();
  19. }

Write a program to find average of three numbers


Three numbers are taken(Input) from the user and avg of these three nos. is calculated(Output).
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. int a,b,c,d,avg;
  7. cout<<"enter a no. ";
  8. cin>>a;
  9. cout<<"enter another no. ";
  10. cin>>b;
  11. cout<<"enter another nos ";
  12. cin>>c;
  13. //Coding by: Snehil Khanor
  14. //http://WapCPP.blogspot.com
  15. d=a+b;
  16. avg=d/3;
  17. cout<<"The average is "<<s;
  18. getch();
  19. }

Write a program to find area of a circle


Radius of circle is taken from user and Area is calculated
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
  1. #include <iostream.h>
  2. #include <conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. float r,a;
  7. cout<<"enter radius ";
  8. //Coding by: Snehil Khanor
  9. //http://WapCPP.blogspot.com
  10. cin>>r;
  11. a=3.14*r*r;
  12. cout<<"The area is "<<a;
  13. getch();
  14. }

Search

About WAP C++

Here you'll find a wide range of programs' solution ranging from beginer level to advanced level.
All programs here are made, compiled and tested by me..and are running absolutely fine.. still if you find any bug in any program do let me know :)

Followers

Subscribe via email

Enter your email address:

Delivered by FeedBurner

my Binary Log



eXTReMe Tracker