本文已参与「新人创作礼」活动,一起开启掘金创作之路。
题目
一共七个作业题目,主要考察c++面向对象,五个版本,vs2019写的,全部满分完美。 题目一:Int[] union_Array (int a[], int lenA, int b[], int lenB)
题目二:student 类及操作
题目三:student 类及操作(链表)
题目四:char *findC (char const *source, char const *obj):
Given a function header as char * findC(char const * source, char const * obj): Write a program to achieve the following tasks:
- Write a function to search a character sequence pointed to by a pointer(called "obj"), in another character sequence(called "source"). Return the pointer pointing to the found character. If there is more than one target found in the source, return the pointer pointing to the first one.(2 marks) Eg1: search for "C"in "ABCDEF", return the pointer point to 'C'. Eg2: search for "Z"in "ABCDEF", return a NULL pointer. Eg3: search for "CD"in "ABCDEF", return the pointer point to'C'. Eg4: search for "CF"in "ABCDEF", return a NULL pointer. Eg5: search for "A"in "ABCAFC", return the pointer point to the first'A'.
- Write a main function to input two strings by the keyboard and print the position of the pointer in the source string(print -1 if the function returns a NULL pointer).(1 mark)
- Compile and run correctly.(2 marks) 题目五:Circle类 Given a circle class to represent circle information as follows: class Circle{ intx; inty; double radius; }; Write a program to achieve the following tasks:
- The centre point of(x,y) and radius should be inputted from the keyboard.(1 mark)
- Define a method that can calculate and return the circle's area.(1 marks)
- Define an overloading operator +to add two circle objects and get a new circle object. The centre point of the new circle object is the same as the centre point of the first circle object. The area of the new circle object should be the sum of the areas of two circle objects(Youcan calculate the radius of the new circle based on the sum of the area of two circles).(2marks)
- Define a function to print relations of two circles(interaction, tangency, separation and inside)(2 marks)
- Define a main function to input two circle obiects, get a new circle object based on these two circle objects and print the relations of these two circle objects.(2 marks)
- Compile and run correctly.(2 marks) 题目六:最小二乘法拟合 题目七:在线商品管理
传送门
若干个版本,不怕查重,均为满分。 download.csdn.net/download/re…
部分运行效果