<<小白的新世界计算机>>开始啦!
第一版(调试1)成功。
#include <iostream>
#include <string>
using namespace std;
struct computer_value{
string up_value;
string down_value;
string down_opr;
string opr;
};
typedef computer_value com;
class computer{
public:
computer_value thisvalue;
bool havedouble;
void print_up_value(){
std::cout<<thisvalue.up_value;
}
string upvalue() {
return thisvalue.up_value;
}
void set_upvalue(string in__) {
thisvalue.up_value=in__;
}
}in_a,in_b;
int main(){
cin>>in_a.thisvalue.up_value;
cout<<in_a.thisvalue.up_value;
cout << endl << in_a.thisvalue.up_value;
return 0;
}
//computer operator + (computer a,computer b)[2版]
#include <iostream>
#include <string>
using namespace std;
struct computer_value{
string up_value;
string down_value;
string down_opr;
string opr;
};
typedef computer_value com;
com operator + (com a,com b,string opr_in){
computer_value anss;
if(a.down_value == "\0"){
anss.down_value=b.down_value;
}else if(b.down_value=="\0"){
anss.down_value=a.down_value;
}
int a__u[1000],a__d[1000],b__u[1000],b__d[1000];
/*string to int* */
for(int i=0,j=(a.up_value).length();i<(a.up_value).length();i++,j--){
a__u[j]=a.up_value[i];
}
for(int i=0,j=(a.down_value).length();i<(a.down_value).length();i++,j--){
a__d[j]=a.down_value[i];
}
for(int i=0,j=(b.up_value).length();i<(b.up_value).length();i++,j--){
b__u[j]=b.up_value[i];
}
for(int i=0,j=(b.down_value).length();i<(b.down_value).length();i++,j--){
b__d[j]=b.down_value[i];
}
int maxlen=a.up_value.length()>b.up_value.length() ? a.up_value.length() : b.up_value.length();
/*to comput plus..*/
for(int i=0;i<maxlen;i++){
}
}
/*class to computer*/
class computer{
public:
computer_value thisvalue;
bool havedouble;
void print_up_value(){
std::cout<<thisvalue.up_value;
}
string upvalue() {
return thisvalue.up_value;
}
void set_upvalue(string in__) {
thisvalue.up_value=in__;
}
string downvalue() {
return thisvalue.down_value;
}
void set_downvalue(string in__) {
thisvalue.down_value=in__;
}
protected:
/*to num...*/
/*string*/
private:
int pri_num__=thisvalue.up_value;
}in_a,in_b;
int main(){
cin>>in_a.thisvalue.up_value;
cout<<in_a.thisvalue.up_value;
cout << endl << in_a.thisvalue.up_value;
return 0;
}