当前位置:网站首页>Experiment 1 simple program design
Experiment 1 simple program design
2022-07-19 06:36:00 【A student of programming】
- Experimental purpose or task
Object oriented software development method is a software development method developed by absorbing useful concepts and effective methods in the field of software engineering . It sets abstraction 、 encapsulation 、 Inheritance and polymorphism in one , It can help programmers develop modularity 、 High degree of data abstraction , Reflect information concealment 、 Reusable 、 Easy to modify 、 Easy to transplant and other features of the program .
This course is based on C++ The object-oriented mechanism in the language is mainly , Discuss the basic idea and method mechanism of object-oriented programming . Through the experimental teaching link , Enable learners to pass a certain amount of program examples and related exercises in the learning process , Gradually master C++ Process oriented and object-oriented functions , So as to master the basic knowledge and skills of object-oriented programming .
Through this experimental teaching link , It can improve learners' professional ability in the following aspects :
- Improve learners' abstract ability and logical thinking ability to solve problems ;
- Preliminarily master the object-oriented software design ideas ;
- Improve learners' self-learning ability of object-oriented program development tools ;
- Make learners have the basic literacy of object-oriented program development .
- Basic requirements of experimental teaching
- Understand and master C++ Advanced features of language functions , Understand the data abstraction and data encapsulation of object-oriented programming , master C++ The mechanism and method of data encapsulation and information hiding through classes and objects ;
- Understand the design idea of object-oriented programming code reuse , master C++ Class inheritance and derivation mechanism and implementation approach ;
- Understand the concept and idea of polymorphism in object-oriented programming , master C++ Operation overload 、 function overloading 、 The mechanism and method of realizing polymorphism by virtual function Technology ;
- Understand and master C++ I/O The idea and method of device independence of stream to realize input and output
Summary
1. Design the program to find 1-100 Prime number between , Show it .
2. Two dimensional array :M A classmate N Course grade processing , The character array stores names .
The basic requirements
use for or while or do-while Loop statement implementation , A program that can sort data , Be able to use two-dimensional array and skillfully input students' grades , lookup , Sort , Output and submit the program .
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int cinLine=0;
for(int i=2;i<=100;i++){
int sqrtNumber = (int)sqrt(i);
int count=0;
for(int j=2;j<=sqrtNumber;j++){
if(i%j==0){
count++;
break;
}
}
if(count==0){
cout<<" "<<i;
cinLine++;
}
}
return 0;
}#include <iostream>
#include <cmath>
#include <cstring>
#define M 5// Define the quantity of Mathematics
#define N 5// Define the number of courses
using namespace std;
struct student{
string name[M];
double studentcore[M][N];
};
class Student {
public:
void insert(){
for(int i=0;i<M;i++){
cout<<" Enter the name of the student : ";
cin>>studentName[i];
cout<<" Enter the students "<<studentName[i]<<" The achievement of :";
for(int j=0;j<N;j++)
cin>>studentCore[i][j];
}
}
void showCore(){
for(int i=0;i<M;i++){
cout<<studentName[i]<<" ";
for(int j=0;j<N;j++)
printf("%5.1f",studentCore[i][j]);
cout<<endl;
}
}
void serach(){
string name;// Name of student to be searched
bool flag=false;
cout<<" Enter the name of the student you want to find :";
cin>>name;
for(int i=0;i<M;i++){
flag=false;
if(name==studentName[i]){
flag=true;
if(flag){
for(int j=0;j<N;j++)
printf("%5.1f",studentCore[i][j]);
}
}
}
}
private:
string studentName[M];// Student's name collection
double studentCore[M][N];// Two dimensional student achievement
};
int main() {
Student student;
student.insert();// Initialize students and grades
student.showCore();// Show students and grades
student.serach();// Find grades by name
return 0;
}边栏推荐
- 实验四 运算符重载和虚函数
- [force buckle] realize stack with queue
- 视图、索引文件的应用
- 2022/07/12 learning notes (day05) cycle
- MEX and Increments
- SeaChest Utilities 工具,让你的硬盘功耗又低又长寿
- Longest bracket match (linear DP)
- 读取图片 进行空间转换 展现不同颜色空间
- Convert PNG with transparency to C array
- Google browser cannot modify cookies manually, and cookies are marked red
猜你喜欢
![Open source online markdown editor -- [editor.md]](/img/f3/b37acf934aa2526d99c8f585b6f229.png)
Open source online markdown editor -- [editor.md]

【力扣】括号匹配
![[force buckle] flip binary tree](/img/9f/d0c5f624ae455c5c010f9a6df5df64.png)
[force buckle] flip binary tree
![[force buckle] ring list II](/img/12/9cbc7081e2f7a87e77faf0e02a8c26.png)
[force buckle] ring list II

自下而上和自上而下的注意力:不同的过程和重叠的神经系统 2014sci

使用候选选择从人类注视中学习视频显著性

Unity2d learning Fox game production process 1: basic game character control, animation effects, lens control, item collection, bug optimization

[antdv: Each record in table should have a unique `key` prop,or set `rowKey` to an unique.....

Restclient multi conditional aggregation

Talking about several solutions of cross domain
随机推荐
Baby Ehab partitions again (DP, construction, bit operation)
Restapi implements aggregation (dark horse tutorial)
基于视觉显著性的外观注视估计
基于运动和视觉突出性的自我视频中的注意预测
Restclient query document
实验三 继承性和派生类
[force buckle] realize queue with stack
Make menuconfig missing ncurses
【力扣】相同的树
你的企业最适合哪种深度学习?
What kind of deep learning is most suitable for your enterprise?
Decorate Apple Tree
[force buckle] design cycle queue
Positional Change of the Eyeball During Eye Movements: Evidence of Translatory Movement眼球运动过程中眼球的位
使用候选选择从人类注视中学习视频显著性
从输入URL到展示出页面
Talking about several solutions of cross domain
视图、索引文件的应用
Salgaze: personalized gaze estimation using visual saliency
TypeScript学习