摘要:
方法1:因为没有异或^这样的直接运算符,计算同或可以转为string类型进行操作,再转为需要的类型 string a,b,res; cin >> a>>b; //0101 1001 这里需要控制一下输入的长度要一样,如果不同的话要自己实现短的前面补0 int length = a.length(); 阅读全文
摘要:
string str,sentence; cin >> str; getline(cin, sentence); cout << str << " "<< sentence << " "; 以上代码定义两个字符串,分别想要为其赋值为"hello" "hello world",但是运行后仅仅能输入he 阅读全文