读勘误

读http://www.cplusplus.com/doc/tutorial/ 笔记,以及勘误

  1. P80,Pointers to structures的示例程序有:
// pointers to structures
#include 
#include 
#include 
using namespace std;
struct movies_t {
string title;
int year;
};
int main ()
{
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;
}
第15行,使用struct声明变量时出现错误,即应该使用 movies_t声明。

你可能感兴趣的:(读勘误)