Write a C++ program to print your name and address.
Answers
Answer:
I hope this answer helps.
Answer:
#include<iostream.h>
#include<conio.h>
void main()
{ clrscr();
char name[100],address[100];
cout<<"\n enter your name and address";
gets(name);
gets(address);
puts(name);
puts(address);
getch();
}
Explanation:
the first two lines are headerfiles, which is a must. then comes the function void main() which doesn't return any value hence the name void. clrscr() will clear the screen to start fresh.
you need to declar the variables using required data types. this is done in the second line after void fucntion.
then the console output function displays a message asking you to type in your name and address. gets function is an input function which will take in the name and address you type in. puts() function will display your name and address as entered before. getch() will hold the output screen for sometime.