7
C ++での文字列型とchar []型の違い
私は少しCを知っていますが、今はC ++を調べています。私はC文字列を処理するために配列をcharするのに慣れていますが、C ++コードを見ると、文字列型とchar配列の両方を使用する例があることがわかります。 #include <iostream> #include <string> using namespace std; int main () { string mystr; cout << "What's your name? "; getline (cin, mystr); cout << "Hello " << mystr << ".\n"; cout << "What is your favorite team? "; getline (cin, mystr); cout << "I like " << …