C++编程问题2条。

1); } n++; } cout<<endl<<"解压后的字符串:"<<endl; cout<<origin<<endl; return 0;}第二题#include<iostream>#include<string>#include<list>using namespace std;class student{public: string number 1); origin.append(&temp0 1); } else { temp1=*i; origin.append(&temp1 1); } n++; } cout<<endl<<"加密后显示的字符串:"<<endl; cout<<result<<endl; string origin; n=0; for(i=result.begin();i 在使用Unicode字符集时 这要看字符集 可能4个字节 一个汉字并不一定占两个字节 用多字节字符集时 name; int cj;public: student(); void Input(student &s); bool operator>(student &s1); student& operator=(student &s2); void Output(student s);};void student::Input(student &s){ cout<<"学号:"; cin>>s.number; cout<<"姓名:"; cin>>s.name; cout<<"分数:"; cin>>s.cj;}void student::Output(student s){ cout<<s.number<<" "<<s.name<<" "<<s.cj<<endl;}student::student(){}bool student::operator>(student &s1){ if(this->cj>s1.cj) return true; else return false;}student& student::operator=(student &s2){ this->cj=s2.cj; this->name=s2.name; this->number=s2.number; return *this;} int main(){ int n; cout<<"请输入你想要输入的学生个数:"<<endl; cin>>n; student stu; list<student> l; for(int i=0;i<n;i++) { cout<<"第"<<i+1<<"个学生:"<<endl; stu.Input(stu); l.push_back(stu); } cout<<"你输入的学生信息如下:"<<endl; cout<<"学号 姓名 成绩"<<endl; for(list<student>::iterator j=l.begin();j =result.end();i++) { if(n%2==0) { temp0=*i; if(n==result.length()-1) origin.append(&temp0 1); result.append(&temp0 1); } else { temp1=*i; result.append(&temp1 temp1; cout<<"请输入你的汉字字符串:"<<endl; cin>>str; for(string::iterator i=str.begin();i 编程实现: 1.求出其中的最大值和最小值及其对应的行列位置; 2.求出对角线上各元素之和 ||| 楼上太猛了  给分把.太强了 ||| 学生类class student{public:string number;string name;int soucs;public:student();void Input(student &s);bool operator>(student &s1);student& operator=(student &s2);void Output(student s);};各函数实现void student::Input(student &s){cout<<"学号:";cin>>s.number;cout<<"姓名:";cin>>s.name;cout<<"分数:";cin>>s.soucs;}bool student::operator>(student &s1){ if (this ->soucs > s1.soucs) { return true; } else { return false; }}void student::Output(student s){cout<<s.number<<endl;cout<<s.name<<endl;cout<<s.soucs<<endl;}student::student(){}然后在主函数中调用就可以了.. ||| 一、输入一个5行5列的二维数组 在gb18030标准字符集中包含了部分4字节汉字 我也要学习 关注ing ||| 汉字的代码占两个字节 这个说法不太精确 =l.end();j++) { if(first) { stu_temp=(*j); point=j; } else { if((*j)>stu_temp) { stu_temp=(*j); point=j; } } first=false; } li.push_back(stu_temp); l.erase(point); } cout<<"按分数排序后:"<<endl; cout<<"学号 姓名 成绩"<<endl; for(j=li.begin();j l.empty()) { student stu_temp; list<student>::iterator point; bool first=true; for(j=l.begin();j =l.end();j++) { stu.Output(*j); } list<student> li; while( =str.end();i++) { if(n%2==0) { temp0=*i; if(n==str.length()-1) result.append(&temp0 result; int n=0; char temp0 #include<iostream>#include<string>using namespace std;int main(){ string str 汉字和英文字母、数字及所有标点符号都是两个字节 =li.end();j++) { stu.Output(*j); } return 0;} ||| 这么有工作量的题目 答起来好苦的
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值