c++基础(17)

来源:互联网 发布:淘宝旗舰店买手机 编辑:程序博客网 时间:2024/06/03 21:01
#include <iostream>#include <string>#include <sstream>using namespace std;struct movies_t {    string title;    int year;};int main(int argc, char const *argv[]){     string mystr;     movies_t amovie;     movies_t * pmovie;     pmovie = &amovie;     cout << "Enter title: ";     getline (cin, pmovie->title);     cout << "Enter year: ";     getline (cin, mystr);     (stringstream) mystr >> pmovie->year;     cout << "\nYou have entered:\n";     cout << pmovie->title;     cout << " (" << pmovie->year << ")\n";     return 0;}
原创粉丝点击