Program to enter an integer and print out its successor

#include <iostream.h>
#include <conio.h>
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.
 

Search site

Copyright © 2012 Dadaso Zanzane. All rights reserved.