C++ cin

1 개요[ | ]

C++ cin
  • 표준입력스트림
a.cpp
#include <iostream>
using namespace std;

int main ()
{
  char name[40];
  cout << "Please enter your name: ";
  cin >> name;
  cout << "Hello, " << name << "!" << endl;
  return 0;
}
jmnote@zetawiki:~$ g++ a.cpp
jmnote@zetawiki:~$ ./a.out
Please enter your name: ABC
Hello, ABC!
jmnote@zetawiki:~$ g++ a.cpp
jmnote@zetawiki:~$ ./a.out
Please enter your name: ABC
Hello, ABC!
jmnote@zetawiki:~$ echo JohnSmith | ./a.out 
Please enter your name: Hello, JohnSmith!
jmnote@zetawiki:~$ echo John Smith | ./a.out 
Please enter your name: Hello, John!

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}