BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/)
-   Object Oriented Programming (http://bzupages.com/300-object-oriented-programming/)
-   -   Program to enter an integer and print out its successor (http://bzupages.com/f300/program-enter-integer-print-out-its-successor-14562/)

bonfire 01-03-2011 02:55 PM

Program to enter an integer and print out its successor
 
1 Attachment(s)
Program to enter an integer and print out its successor


#include
#include
void value(int);

void main()
{
clrscr();
int x;
cout << "Enter an integer : ";
cin>>x;
cout << "The successor of " << x << " is ";
value(x);
getch();
}
void value(int x)
{
x++;
cout << x << "." << endl;
}
This program takes in an integer x as a screen input from the user.
It then determines the successor of the integer and outputs it using the 'cout' command.



Sample Input
49
Sample Output

The successor of 49 is 50.


All times are GMT +5. The time now is 01:53 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.