`
隐形的翅膀
  • 浏览: 483764 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

常用的头文件

 
阅读更多
1. printf,snprintf

need #include <stdio.h>

2. cout and cin

#include <iostream.h>
using namespace std;

3. accept string using cin


#include <iostream>
#include <string> // or #include "string.h"
using namespace std;

int main() {

 string input = "";

 // How to get a string/sentence with spaces
 cout << "Please enter a valid sentence (with spaces):\n>";
 getline(cin, input);
 cout << "You entered: " << input << endl << endl;
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics