C 程式設計題目,C 程式設計題

2021-05-08 18:15:36 字數 3173 閱讀 5232

1樓:雷震八方

"teacher.h"

#ifndef class_teacher

#define class_teacher

#include

#include

#include

using namespace std;

/* 所有教師的父類

class teacher

;//count為課時的數目

private:

int salary;//固定工資,預設為整數

int count;//課時數目

int assistance;//課時補助,預設為整數

string name;

};#endif

"professor.h"

#ifndef class_professor

#define class_professor

#include "teacher.h"

#include

#include

#include

/* 教授類

class professor:public teacher

;#endif

"instructor.h"

#ifndef class_instructor

#define class_instructor

#include

#include

#include

using namespace std;

/* 講師類

class instructor

;#endif

"associateprofessor.h"

#ifndef class_associateprofessor

#define class_associateprofessor

#include

#include

#include

using namespace std;

/* 副教授類

class associateprofessor

;#endif

"teacher.cpp"

#include "teacher.h"

teacher::teacher()

teacher::teacher(string name)

teacher::teacher(int salary,int assistance,string name)

void teacher::setassistancecount(int count)

int teacher::getcount()

"professor.cpp"

#include "professor.h"

professor::professor()

professor::professor(string name)

int professor::sum(int count)

void professor::setassistancecount(int count)

int professor::getcount()

"instructor.cpp"

#include "instructor.h"

instructor::instructor()

instructor::instructor(string name)

int instructor::sum(int count)

void instructor::setassistancecount(int count)

int instructor::getcount()

"associateprofessor.cpp"

#include "associateprofessor.h"

associateprofessor::associateprofessor()

associateprofessor::associateprofessor(string name)

int associateprofessor::sum(int count)

void associateprofessor::setassistancecount(int count)

int associateprofessor::getcount()

"testing.cpp"

#include "associateprofessor.h"

#include "instructor.h"

#include "professor.h"

#include "teacher.h"

void main()

不知道是否符合要求,(都已經除錯通過)

執行環境:visual c++ 6.0

作業系統:xp

你要想要源**,可給我發

e_mail:[email protected]

2樓:彌寄牽暢然

b.aa1=a1;是錯的

c++程式設計題

3樓:匿名使用者

#include

#include

using namespace std;

struct student

s[7];

int main()

for(int i=0;i<5;i++)}

4樓:苦中作樂香蕉

#include

using namespace std;

const int n=5;

int ma***x;

double cunt=0;

struct student

friend istream &operator >>(istream &i,student &k)

} stu[n+1];

int main() {

for(int i=1; i<=n; i++)cin>>stu[i];

cout<<"平均分:"<

急求一道c++程式設計題!!!

5樓:gta小雞

return sum/n;}

C語言程式設計題c語言題目程式設計題

輸入1 個正整數 n,計算並輸出 s 的前n項的和 保留 3 位小數 s 1 4 4 5 5 9 9 14 14 23 該序列從第2項起,每一項的分子是前一項的分母,分母是前一項的分子和分母之和 例 括號內是說明 輸入 10 n 10 輸出 5.950 include void main print...

C語言程式設計題,c語言程式設計問題,題目是2程式設計計算

include include include int main void value a b printf answer is 6.2f n value system pause return 0 c語言程式設計問題,題目是 2 程式設計計算1 2 3 3 5 4 7 5 9 include in...

c語言程式設計題,C語言程式設計題

首先分析問題 bai重複du輸出同一類語句肯定要用迴圈,zhi有關判斷肯dao定要用分支回。所以解決這個問題就是在一個答迴圈 用於重複讀取資料和輸出 裡面套一個分支語句 判斷密碼是數字還是字母 具體 include include include main else printf error n s...