VCで文字列を入力したいが、私のプログラムを実行するとgetline関数が機能しなかったようだが、 "cin"部分はスキップされた。ここに私のコードはVCに文字列を入力するには
printf("Exercise 1\n");
printf("Please enter the sentence you want\n");
char str[256];
std::cin.getline(str, 256);
std::cout << str;
であるここに私のヘッダーは、私はVS2015のコミュニティを使用してい
#include <iostream>
#include <string>
#include <bitset>
あり、私のコンパイラに何か問題はありますか?
'文字列str [256];' - > 'のstd ::文字列str;' 'のstd :: cin.getline(STR、256);' - > ' std :: getline(std :: cin、str); '空は再び青色になります。 –
別の本を入手してください。 * string *とtextに対して 'std :: string'を使うべきです。 –