注册 登录
编程论坛 C++教室

C++小问题

jackietin 发布于 2009-11-16 02:26, 489 次点击
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;
}
2 回复
#2
flyingcloude2009-11-17 00:05
程序代码:
#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 编辑 ]
#3
flyingcloude2009-11-17 00:07
程序代码:
#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;
}

1