为什么数组不打印列表
Why array does not print list?
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int i;
char s[10] = {'a' , 'b' ,'c' 'd' ,'e', 'f', 'g', 'g','h','i'};
cout << "element" << setw(7) << "value " << endl;
for (i=0 ; i <10 ; i++)
cout << i << setw(7) << s[i] << endl;
return 0;
}
我想要 tp 获取列表,例如
element value
0 a
1 b
2 c
3 d
4 e
5 f
6 g
7 g
8 h
9 i
但是编译器给出了错误....有没有人可以指出我的错误?
初始值设定项列表中有一个拼写错误。您忘了放置逗号
char s[10] = {'a' , 'b' ,'c' 'd' ,'e', 'f', 'g', 'g','h','i'};
^^^^
相关文章:
- 为什么它只打印双链接列表的第一个值,而我的程序却崩溃了
- 链接列表运算符重载没有打印出我想要的内容
- 直接 2D 呈现到命令列表和打印:图片压缩
- C++声明双链表,使用两个 for 循环双向遍历列表并打印
- 如何获取列表的每个对象并调用getName方法来打印其名称
- 只有我的"链接列表"中的第一个节点正在打印
- C++ - 使用 std::list,如何打印对象的私有成员的链接列表?
- C++使用相反的顺序打印带有逗号的列表
- 如何实现否定用户输入退出程序和打印列表?
- 打印/修改类对象的特定成员变量,其类定义列表 (STL) 包含的元素类型
- C++:一种在列表中打印所有对的优雅方式
- C 打印集合列表
- 如何打印简单的链接列表(C )
- 如何编写循环以通过列表迭代并打印列表中每个元素的数据的数据
- 使用for_each从对象列表中调用打印功能
- 我的链接列表打印功能进入无限循环
- 链接列表打印null -C
- 链接列表打印不起作用.
- 将整数列表打印为逗号分隔的数字列表,每行最多 10 个
- 奇怪的列表打印函数行为。如果我打印"n"则有效,如果我删除它则不起作用