VC++中 undeclared identifier

#include<iostream>#include<iomanip>usingnamespacestd;intmain(){constintn=30;inti,a[n]... #include <iostream>
#include <iomanip>
using namespace std ;

int main()
{ const int n = 30 ;
int i , a[n];
cout << "Enter" << n << "integers \n" ;
for (i=0 ; i<n ; i++ )
cin >> a [i];
cout << " \nThe integers in serverse order : \n";
for ( i=0 ; i<n ; i++ )
cout << setw(6) << a[n-i-1] << (i%10==9? '\n':' ');
return 0;
}

编译没错,组建是有一下错误

d:\c++\microsoft visual studio\myprojects\test1\te02.c(2) : error C2061: syntax error : identifier 'namespace'
d:\c++\microsoft visual studio\myprojects\test1\te02.c(2) : error C2059: syntax error : ';'
d:\c++\microsoft visual studio\myprojects\test1\te02.c(4) : warning C4305: 'initializing' : truncation from 'const double ' to 'const float '
d:\c++\microsoft visual studio\myprojects\test1\te02.c(8) : error C2065: 'cout' : undeclared identifier
d:\c++\microsoft visual studio\myprojects\test1\te02.c(8) : error C2297: '<<' : illegal, right operand has type 'char [3]'
d:\c++\microsoft visual studio\myprojects\test1\te02.c(9) : error C2065: 'cin' : undeclared identifier
d:\c++\microsoft visual studio\myprojects\test1\te02.c(9) : error C2296: '>>' : illegal, left operand has type 'float '
d:\c++\microsoft visual studio\myprojects\test1\te02.c(9) : error C2297: '>>' : illegal, right operand has type 'float '
d:\c++\microsoft visual studio\myprojects\test1\te02.c(11) : error C2297: '<<' : illegal, right operand has type 'char [3]'
d:\c++\microsoft visual studio\myprojects\test1\te02.c(11) : error C2065: 'endl' : undeclared identifier
d:\c++\microsoft visual studio\myprojects\test1\te02.c(12) : error C2297: '<<' : illegal, right operand has type 'char [3]'
执行 cl.exe 时出错.
展开
 我来答
bhtzu
2013-09-25 · TA获得超过1.1万个赞
知道大有可为答主
回答量:8088
采纳率:85%
帮助的人:4581万
展开全部

我这可以正常编译运行。除了30改3,没有其它改动。

网易云信
2023-12-06 广告
UIkit是一套轻量级、模块化且易于使用的开源UI组件库,由YOOtheme团队开发。它提供了丰富的界面元素,包括按钮、表单、表格、对话框、滑块、下拉菜单、选项卡等等,适用于各种类型的网站和应用程序。UIkit还支持响应式设计,可以根据不同... 点击进入详情页
本回答由网易云信提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式