7.6
2015-06-15 23:06
232 查看
#include <iostream> #include <strstream> using namespace std; typedef struct student {int num; char name[20]; double score; }; int main() { student stud[3]={1001,"Li",78,1002,"Wang",89.5,1004,"Fun",90}, dstud1[3]; student stud1[3]; char c[50]; int i; ostrstream strout(c,50); for(i=0;i<3;i++) strout<<stud[i].num<<" "<<stud[i].name<<" "<<stud[i].score<<" "; strout<<ends; cout<<"array c:"<<endl<<c<<endl<<endl; istrstream strin(c,50); for(i=0;i<3;i++) strin>>stud1[i].num>>stud1[i].name>>stud1[i].score; cout<<"data from array c to array stud1:"<<endl; for(i=0;i<3;i++) cout<<stud1[i].num<<" "<<stud1[i].name<<" "<<stud1[i].score<<endl; cout<<endl; return 0; }
相关文章推荐
- Windows Phone 六、JSON序列化
- MySQL优化GROUP BY-松散索引扫描与紧凑索引扫描
- Uva - 548 - Tree
- Uva - 548 - Tree
- maven2-snapshot快照库和release发布库的应用
- Android开发由eclipse转Android Studio中一些常见出错问题解决方法
- epoll使用详解
- 44Exchange 2010升级到Exchange 2013-公网切换
- Maven2-profile多环境配置
- Entity Framework实现多列排序
- Codeforces Beta Round #92 (Div. 2 Only) B. Permutations 模拟
- HDU 3006
- 二叉查找树(1) - 查找以及插入
- 四种方案解决ScrollView嵌套ListView问题
- Window7 下 Eclipse 部署JBOSS 下 The LogManager was not properly installed 问题解决
- Spring 模板+回调
- MySQL如何利用索引优化ORDER BY排序语句
- Java面向对象 局部内部类的一些特点
- 临终病人最后悔的五件事
- Implementation of Self-signed SSL certificate for your App.