Write a C or C++ Programme to display your full name, first name, middle name & Last name with output
Program
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("First Name, Middle Name, Last Name\n");
getch();
}
Output
John Lory Clinton
Changes for C++
If you want to write the same program in c++ apply the following changes to the program.
1.) change the header file from "#include<stdio.h>" to "#include<iostream>.h"
2.) for input & output use "cout<<" & "cin>>" instead of "printf" & "scanf".
3.) don't use "% "symbol and "&" sign in "cin>>" statement.
Program
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("First Name, Middle Name, Last Name\n");
getch();
}
Output
John Lory Clinton
Changes for C++
If you want to write the same program in c++ apply the following changes to the program.
1.) change the header file from "#include<stdio.h>" to "#include<iostream>.h"
2.) for input & output use "cout<<" & "cin>>" instead of "printf" & "scanf".
3.) don't use "% "symbol and "&" sign in "cin>>" statement.
No comments:
Post a Comment