uacs2024

导航

上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 24 下一页

2024年3月23日 #

复试C++看程序写结果 易错

摘要: 复试C++看程序写结果 易错 #include <iostream> using namespace std; void function(char *& s1, char *& s2){ int i = 0; for(; *s1 != *s2; s1++, s2++) i++; //当两个指针同时 阅读全文

posted @ 2024-03-23 17:19 ᶜʸᵃⁿ 阅读(18) 评论(0) 推荐(0)

2024年3月22日 #

C++看程序写结果:类继承与类组合,默认与含参的构造先后顺序 易错

摘要: C++类继承与类组合,默认与含参的构造先后顺序 易错 这道题原本是没有那么多输出信息的,是我自己加上了调用什么函数的提示。 一开始以为就输出两行,一行是构造父类时A:5,一行是构造子类时x=5,A::x=5。 #include "bits/stdc++.h" using namespace std; 阅读全文

posted @ 2024-03-22 17:55 ᶜʸᵃⁿ 阅读(20) 评论(0) 推荐(0)

复试C++19真题_看程序写结果_前置++运算符重载 易错

摘要: 考察前置++运算符设置为友元函数,这题的坑在于,返回值是不是对象的引用,形参也不是对象的引用,导致自增离开了作用域以后就不在有任何效果。 #include <iostream> using namespace std; class C{ private: int xx,yy; public: C(i 阅读全文

posted @ 2024-03-22 15:00 ᶜʸᵃⁿ 阅读(16) 评论(0) 推荐(0)

2024年3月21日 #

复试C++16真题_程序设计1_输出句子中每个单词长度

摘要: 输入一行文本,按照相应格式输出每个单词的长度 #include <iostream> using namespace std; #include <string> #include <vector> #include <iomanip> int main(){ string sen = " qwe 阅读全文

posted @ 2024-03-21 18:50 ᶜʸᵃⁿ 阅读(29) 评论(0) 推荐(0)

复试C++15真题_程序设计4_查找字符串并替换 ??

摘要: 复试C++15真题_程序设计4_查找字符串并替换 编写findRepStr函数,功能为在字符串str中寻找目的字符串findStr,并用replaceStr字符串替换,最后输出替换后的字符串str 我不知道可不可以用string,于是我用了字符数组,用暴力匹配寻找字符串。 #include <ios 阅读全文

posted @ 2024-03-21 17:23 ᶜʸᵃⁿ 阅读(42) 评论(0) 推荐(0)

2024年3月20日 #

复试C++15真题_程序设计2_递归_输入字符串倒序转整形

摘要: 编写一个递归函数,功能为:输入一个字符串,输出一个整数值。例如输入 "1a2xcz3 4 ,5a!6" , 输出654321。 一开始想不明白怎么写递归,于是我写了迭代的函数。意识到,递归的过程就是实现了迭代的循环,而循环内的操作本质没有太大差别。于是就写出来了: #include <iostrea 阅读全文

posted @ 2024-03-20 20:42 ᶜʸᵃⁿ 阅读(25) 评论(0) 推荐(0)

复试C++14真题 看程序写结果5 虚函数、继承 易错?

摘要: 复试C++14真题 看程序写结果5 虚函数、继承 #include <iostream> using namespace std; class A{ public: virtual void print() {cout<<"A::print"<<endl;} //void print() {cout 阅读全文

posted @ 2024-03-20 18:31 ᶜʸᵃⁿ 阅读(14) 评论(0) 推荐(0)

C++一些函数用法

摘要: substr(start , lenth) erase(start , lenth) assign(v.begin() , v.end()) vl(a+i , a+j) 相当于用a[i] 到 a[j-1] 的元素初始化v1 , 包括a[j-1] stod函数用法 stoi函数用法 #include 阅读全文

posted @ 2024-03-20 14:44 ᶜʸᵃⁿ 阅读(6) 评论(0) 推荐(0)

2024年3月18日 #

C++看程序写结果:调用一次Line类构造函数,执行几次Point类复制构造函数?

摘要: C++看程序写结果:调用一次Line类构造函数,执行几次Point类复制构造函数? #include <iostream> #include <cmath> using namespace std; class Point { //Point类定义 public: Point(int xx = 0, 阅读全文

posted @ 2024-03-18 21:05 ᶜʸᵃⁿ 阅读(49) 评论(0) 推荐(0)

2024年3月17日 #

19笔试真题:看程序写结果,含有内嵌对象的类的构造函数调用次序

摘要: 看程序写结果,含有内嵌对象的类的构造函数调用次序 #include <iostream> using namespace std; class Student1{ public: Student1() {cout << "Student1+" << endl; } ~Student1() { cou 阅读全文

posted @ 2024-03-17 18:40 ᶜʸᵃⁿ 阅读(17) 评论(0) 推荐(0)

上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 24 下一页