0143919但亚平
来源:互联网 发布:中国电网logo知乎 编辑:程序博客网 时间:2024/04/29 03:01
#include <iostream>using namespace std;class Time {public:void set_time();void show_time();private: //成员改为公用的 int hour; int minute; int sec; };void Time::set_time() //在main函数之前定义 { cin>>hour; cin>>minute; cin>>sec; }void Time::show_time() //在main函数之前定义 { cout<<hour<<":"<<minute<<":"<<sec<<endl; }int main(){Time t1;t1.set_time(); t1.show_time(); return 0; }
#include <iostream>using namespace std;class Time {public: void set_time(void) {cin>>hour; cin>>minute; cin>>sec; } void show_time(void) {cout<<hour<<":"<<minute<<":"<<sec<<endl;} private: int hour; int minute; int sec; };Time t;int main() { t.set_time(); t.show_time(); return 0; }
#include <iostream>using namespace std;class Time {public: void set_time(void); void show_time(void); private: int hour; int minute; int sec; };void Time::set_time(void) {cin>>hour; cin>>minute; cin>>sec; }void Time::show_time(void){cout<<hour<<":"<<minute<<":"<<sec<<endl;}Time t;int main(){ t.set_time(); t.show_time(); return 0;}
//xt2-4-1.cpp(main.cpp)#include <iostream>using namespace std;#include "xt2-4.h"int main(){Student stud; stud.set_value(); stud.display(); return 0;}//xt2-4-2.cpp(即student.cpp)#include "xt2-4.h" //在此文件中进行函数的定义#include <iostream>using namespace std; //不要漏写此行void Student::display( ) { cout<<"num:"<<num<<endl; cout<<"name:"<<name<<endl; cout<<"sex:"<<sex<<endl;}void Student::set_value(){ cin>>num;cin>>name; cin>>sex;}
//xt2-5-1.cpp(file1.cpp)#include <iostream>#include "xt2-5.h"int main() {Array_max arrmax; arrmax.set_value(); arrmax.max_value(); arrmax.show_value(); return 0; }//xt2-5-2.cpp(arraymax.cpp)#include <iostream>using namespace std;#include "xt2-5.h"void Array_max::set_value() { int i; for (i=0;i<10;i++) cin>>array[i]; }void Array_max::max_value() {int i; max=array[0]; for (i=1;i<10;i++) if(array[i]>max) max=array[i]; }void Array_max::show_value() {cout<<"max="<<max<<endl; }
#include <iostream>using namespace std;class Box{public: void get_value(); void volume(); void display(); public: float lengh; float width; float height; float vol; };void Box::get_value(){ cout<<"please input lengh, width,height:"; cin>>lengh; cin>>width; cin>>height;}void Box::volume(){ vol=lengh*width*height;}void Box::display(){ cout<<vol<<endl;}int main(){Box box1,box2,box3; box1.get_value(); box1.volume(); cout<<"volmue of bax1 is "; box1.display(); box2.get_value(); box2.volume(); cout<<"volmue of bax2 is "; box2.display(); box3.get_value(); box3.volume();cout<<"volmue of bax3 is "; box3.display(); return 0;}
0 0
- 0143919但亚平
- 0143919但亚平
- 对辽足退出亚冠表示理解但不支持
- 亚嵌
- 亚像素
- 亚像素
- 亚像素
- 但却沉着平跟
- 亚也的一生
- 亚也的一生
- 亚信面试笔试~~
- 亚威网上课堂隆重推出!
- 哈利路亚
- 亚毕业设计--前言
- 亚原子粒子基础
- 华亚903
- 卡地亚 Cartier
- 亚像素(Pixel)
- Java基础第五讲
- C++
- 颠倒句子中词的顺序
- Windows 中OpenBlas 的安装 - Windows 32bit 适用
- 基于maven的spring mvc项目
- 0143919但亚平
- HDU ACM 1251字典树(Trie)
- hdu2062
- 黑马程序员---java---集合
- LinkedHashMap
- LeetCode - Roman to Integer
- 记录jquey的学习过程
- 推荐系统
- no qualifying bean of type [...] is define