标题:C++小问题
只看楼主
jackietin
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2009-10-30
结帖率:100%
已结贴  问题点数:20 回复次数:2 
C++小问题
1、C++中数组的元素可以还是数组吗?如果行的话,如何进行元素的添加、删除和提取等操作?

2、下面这个程序有什么问题? 测试通过不了。。

#include <iostream>
#include <list>
using namespace std;
// typedef list<list<int>> LISTINT;
void main()
{
list<list<int>> list1 = new list<list<int>>();
// LISTINT list1 = new LISTINT;
list list2=new list(10,6);
list1.push_back(list2);

cout<<list1.front()<<endl;
}
搜索更多相关主题的帖子: void 测试 include 如何 
2009-11-16 02:26
flyingcloude
Rank: 10Rank: 10Rank: 10
等 级:青峰侠
威 望:6
帖 子:598
专家分:1512
注 册:2008-1-13
得分:10 
程序代码:
#include <iostream>
#include <list>
using namespace std;
// typedef list<list<int>> LISTINT;
int main()
{
list<list<int>* > *list1 = new list<list<int>* >();
// LISTINT list1 = new LISTINT;
list<int>* list2 = new list<int>(10,6);
list1->push_back(list2);
cout<<list1->front()<<endl;
}



[ 本帖最后由 flyingcloude 于 2009-11-17 00:07 编辑 ]

你能学会你想学会的任何东西,这不是你能不能学会的问题,而是你想不想学的问题
2009-11-17 00:05
flyingcloude
Rank: 10Rank: 10Rank: 10
等 级:青峰侠
威 望:6
帖 子:598
专家分:1512
注 册:2008-1-13
得分:10 
程序代码:
#include <iostream>
#include <list>
using namespace std;
typedef list<list<int>* > LISTINT;
int main()
{
//list<list<int>* > *list1 = new list<list<int>* >();
LISTINT *list1 = new LISTINT;
list<int>* list2 = new list<int>(10,6);
list1->push_back(list2);
cout<<list1->front()<<endl;
}


你能学会你想学会的任何东西,这不是你能不能学会的问题,而是你想不想学的问题
2009-11-17 00:07



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-292426-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.156338 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved