
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 时出错. 展开
#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 时出错. 展开
1个回答

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