Labels

Thursday, December 24, 2015

To print the next character accepted from the user;

To print the next character accepted from the user;
#include
int main()
{
char a,b;
printf("Enter any character: ");
a= getchar();
int c=a;
int d=c+1;
printf("The alterante of character user entered is ");
b= putchar(d);
printf("\n");
return 0;
}

Print next character

To compile this program in Linux:
  1. Save this file with extension .c
  2. g++ compiler come pre installed in linux. Type this in terminal g++ alternate.c -o alternate. Here, I have assumed that the file name is alternate.c. -o array will provide me with an output file with extension exe file and name alternate.
  3. Now, run this file typing ./alternate and press enter.
To compile this program using cmd:
  1. Save this file with extension.c
  2. Type this in the cmd g++ alternate.c -o alternate.
  3. To run type alternate and press enter.
Note: To use g++ compiler in windows user has to install these compiler by itself as g++ compiler does not come per installed in windows operating system.



No comments:

Post a Comment