首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

简单的数组的有关问题?高手帮忙

2012-02-09 
简单的数组的问题??高手帮忙怎样才可以把下面的一东西存放在一个数组中不管是一还是2维的都可以??那为高手

简单的数组的问题??高手帮忙
怎样才可以把下面的一东西存放在一个数组中     不管是一还是2维的都可以??
      那为高手帮帮忙   ??       是一道题目

4873279
ITS-EASY
888-4567
3-10-10-10
888-GLOP
TUT-GLOP
967-11-11
310-GINO
F101010
888-1200
-4-8-7-3-2-7-9-
487-3279


[解决办法]
# include <stdio.h>
main ()
{char box[12][20]={ " ",};

int i=0;
for (;i <12;i++)
gets(box[i]);
i=0;
for (;i <12;i++) puts(box[i]);

printf( "%d\n ",i);
system( "pause ");
return 0;
}
[解决办法]
//C++实现
#include <iostream>
#include <vector>
using namespace std;
int main()
{vector <string> box;
string ch;
cin> > ch;
while(ch != "! ")//以感叹号结束输入
{box.push_back(ch);
cin> > ch;
}
vector <string> ::iterator p=box.begin();
while(p != box.end())
cout < <*p++;
system( "PAUSE ");
return 0;
}

热点排行
Bad Request.