im a highschool student and i really need help bout this....

how can i make a program that will enter my name and display it automatically.....

Recommended Answers

All 3 Replies

#include <iostream>
#include <string>
using namespace std;

int main(){
  string yourName;
  cout<<"Enter your name: ";
  cin>>yourName;
  cout<<"Your name is: "<<yourName<<endl;
  return 0;
}
#include <iostream>
#include <string>
using namespace std;

int main(){
  string yourName;
  cout<<"Enter your name: ";
  cin>>yourName;
  cout<<"Your name is: "<<yourName<<endl;
  return 0;
}

or without using <strings>

#include <iostream>
using namespace std;

int main(){
  char yourName[100]; /*you must declare how much input you're going to read */
  cout<<"Enter your name: ";
  cin>>yourName;
  cout<<"Your name is: "<<yourName<<endl;
  return 0;
}

Kind Regards

hey guys_!!!!
tnx for the support!!!!
Luvyah all!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.