|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- #include <stdafx.h>
- #include <iostream>
- void main()
- {
- int i;
- std::cin >> i;
- while(i != 42)
- {
- std::cout << i <<std::endl;
- std::cin >> i;
- }
- }
- 这样就编译通过,但是要是把#include <iostream>放到上面就不行了
- #include <iostream>
- #include <stdafx.h>
- void main()
- {
- int i;
- std::cin >> i;
- while(i != 42)
- {
- std::cout << i <<std::endl;
- std::cin >> i;
- }
- }
- Compiling...
- 1221.cpp
- E:\C++代码\1221\1221.cpp(8) : error C2653: 'std' : is not a class or namespace name
- E:\C++代码\1221\1221.cpp(8) : error C2065: 'cin' : undeclared identifier
- E:\C++代码\1221\1221.cpp(8) : warning C4552: '>>' : operator has no effect; expected operator with side-effect
- E:\C++代码\1221\1221.cpp(11) : error C2653: 'std' : is not a class or namespace name
- E:\C++代码\1221\1221.cpp(11) : error C2065: 'cout' : undeclared identifier
- E:\C++代码\1221\1221.cpp(11) : error C2653: 'std' : is not a class or namespace name
- E:\C++代码\1221\1221.cpp(11) : error C2065: 'endl' : undeclared identifier
- E:\C++代码\1221\1221.cpp(11) : warning C4552: '<<' : operator has no effect; expected operator with side-effect
- E:\C++代码\1221\1221.cpp(12) : error C2653: 'std' : is not a class or namespace name
- E:\C++代码\1221\1221.cpp(12) : warning C4552: '>>' : operator has no effect; expected operator with side-effect
- 执行 cl.exe 时出错.
- Creating browse info file...
- 错误代码如上
复制代码 为什么会这样
|
|