我刚开始C++我正在阅读电子书从C++第7版开始。我复制了本书中的代码,并将其放入Visual,带有预编译头文件的新项目w32控制台应用程序下。那么当我在预处理器指令行中使用iostream时,我得到了..我四处搜索,并不明白为什么iostream不起作用,有什么帮助?Visual C++不允许iostream
1>------ Build started: Project: dd, Configuration: Debug Win32 ------ 1> stdafx.cpp 1> dd.cpp 1>c:\documents and settings\leon\my documents\visual studio 2010\projects\dd\dd\dd.cpp(24): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source? ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
1 // This program calculates the user's pay.
2 #include <iostream>
3 using namespace std;
4
5 int main()
6 {
7 double hours, rate, pay;
8
9 // Get the number of hours worked.
10 cout << "How many hours did you work? ";
11 cin >> hours;
12
13 // Get the hourly pay rate.
14 cout << "How much do you get paid per hour? ";
15 cin >> rate;
16
17 // Calculate the pay.
18 pay = hours * rate;
19
20 // Display the pay.
21 cout << "You have earned $" << pay << endl;
22 return 0;
23 }
好的。它在我身上发现它有一种混乱。 – user1211008 2012-02-15 10:29:47