当前位置:网站首页>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;
}边栏推荐
- Antd is not defined
- 2022/07/12 learning notes (day05) JS built-in functions
- 从零开始的 Rust 语言 blas 库之预备篇(1)—— blas 基础介绍
- 通過VOR深度估計解决三維注視交互中的目標模糊問題
- Using VOR depth estimation to solve the problem of target ambiguity in three-dimensional gaze interaction
- 斑点检测 记录
- [force buckle] realize queue with stack
- Guess the string (dichotomy, interaction)
- [force buckle] design cycle queue
- 山西省第二届网络安全技能大赛(企业组)部分赛题WP(一)
猜你喜欢

Perceive the attention status of users on smart phones

实验二 类与对象定义初始化
![[force buckle] realize queue with stack](/img/cb/7c4d01cab50b8027b8a4d67509b7dd.png)
[force buckle] realize queue with stack

DSL implements bucket aggregation

【力扣】对称二叉树

Antd is not defined

Common serial communication UART seen from pictures
![[force buckle] symmetric binary tree](/img/a4/31e936fb242aa8a3243ea257f5fd29.png)
[force buckle] symmetric binary tree

虚拟现实中的眼睛跟踪

What kind of deep learning is most suitable for your enterprise?
随机推荐
2022/07/10 第五小组 丁帅 学习笔记 day03
【力扣】相同的树
[force buckle] flip binary tree
【力扣】翻转二叉树
Perception de l’état d’attention des utilisateurs sur les smartphones
[bjoi2019] platoon formation (Group backpack)
Restclient multi conditional aggregation
浅谈跨域的几种解决方案
Manjaro 系统日常使用入门导引
Knapsack with dependency, narrow sense (binary enumeration), broad sense (tree DP)
Single table query, add, update and delete data
Eye tracking in virtual reality
2022 robocom world robot developer competition - undergraduate group (provincial competition)
实验二 类与对象定义初始化
Leetcode string
Learning non posture gaze deviation with head movement
数据库的查询(二)
第五章 我们可以直接调用run()方法来启动一个新线程吗
Quantum three body problem: an overview of numerical computation
基于运动和视觉突出性的自我视频中的注意预测