Welcome![Sign In][Sign Up]
Location:
Search - iostream m

Search list

[Other resourceiostream.hiiostream

Description: iostream.h和iiostream的区别iostream .h和iiostream的区别iostream .h和iiostream的区别-iostream.h and iiostream distinction and ii iostream.h ostream distinction iostream.h and iiostream distinction iostrea m.h and iiostream distinction iostream.h and the difference i iiostream ostream.h and iiostream distinction iostream.h and iiostre The distinction am
Platform: | Size: 1641 | Author: 包杰 | Hits:

[Otherc++123

Description: #include<iostream> using namespace std class ABC { private: double i,j public: ABC(int x,int y):i(x),j(y) {} ABC() {} double add() { return i+j } double jian() { return i-j } double cheng() { return i*j } double div() { return i/j } } void main() { int m,n char op cout<<\"input\" cin>>m>>op>>n ABC a(m,n) switch(op) { case + :cout<<a.add() break case - :cout<<a.jian() break case * :cout<<a.cheng() break case / :cout<<a.div() break default:cout<<\"error\" } cout<<endl } -# include
Platform: | Size: 548 | Author: 飞鹰 | Hits:

[Otherp219__3__2

Description: #include<iostream> using namespace std class Point {public: Point(int a){x=a } ~Point(){cout< \"execuing Point destructor\"<<endl } private: int x } class Circle:public Point {public: Circle(int m,int n):Point(m){radius=m } ~Circle(){cout<<\"execuing Circle destructor\"<<radius<<endl } private: int radius } int main() {Point *p=new Circle(5,12) delete p system(\"pause\") return 0 }
Platform: | Size: 1702 | Author: 华盛 | Hits:

[Otherdv

Description: #include<iostream> using namespace std class Point {public: Point(int a){x=a } ~Point(){cout< \"execuing Point destructor\"<<endl } private: int x } class Circle:public Point {public: Circle(int m,int n):Point(m){radius=m } ~Circle(){cout<<\"execuing Circle destructor\"<<radius<<endl } private: int radius } int main() {Point *p=new Circle(5,12) delete p system(\"pause\") return 0 }
Platform: | Size: 2090 | Author: 华盛 | Hits:

[OtherC++程序设计语言实验三

Description: 实验三:C++编程入门 一、实验内容 1. 类模版。 2. 运算符重载。 3. 友元。 4. 继承。 二、实验题目 1, 设计一个类SavingsAccount,定义一个静态数据成员记录存款的年利率(rate),该类的每个成员都包含一个私有的数据成员balance,表示该成员当前的存款数额。提供一个成员函数CalMonthlyInterest(),用以计算月利息(用balance乘以rate再除以12),并将这个月利息加入balance中。提供一个静态成员函数ModifyRate(),用以改变静态数据成员rate的值。定义两个不同的SavingsAccount对象saver1和saver2,当前存款数额balance分别为2000.00和3000.00。首先将rate设置为3%,计算每个存款人的月息并打印新的结果,然后将rate设置为4%,再次计算每个存款人的月息并打印新的结果。 2, 设计一个学生类student,包括学生学号、姓名、成绩;设计一个友元函数,比较某两个学生成绩的高低;读入一个文本文件(格式如示例studengt.txt,每行的学号、姓名、成绩之间用四个空格隔开)中所有学生的学号、姓名、成绩,输出最高成绩和最低成绩的学生信息(学号、姓名、成绩)。 3, 阅读下面例子,将题中的Time类声明为Data类的友元类,通过Time类中的display函数引用Data类的私有数据,输出年、月、日和时、分、秒。 #include <iostream> using namespace std; class Date; //对Date类的提前引用声明 class Time //定义Time类 { public: Time(int,int,int); void display(Date &); //display是成员函数,形参是Date类对象的引用 private: int hour; int minute; int sec; }; class Date //声明Date类 { public: Date(int,int,int); friend void Time∷display(Date &); //声明Time中的display函数为友元成员函数 private: int month; int day; int year; }; Time∷Time(int h,int m,int s) //类Time的构造函数 { hour=h; minute=m; sec=s; } void Time∷display(Date &d) //display的作用是输出年、月、日和时、分、秒 { cout<<d.month<<″/″<<d.day<<″/″<<d.year<<endl; //引用Date类对象中的私有数据 cout<<hour<<″:″<<minute<<″:″<<sec<<endl; //引用本类对象中的私有数据 } Date∷Date(int m,int d,int y) //类Date的构造函数 { month=m; day=d; year=y; } int main( ) { Time t1(10,13,56); //定义Time类对象t1 Date d1(12,25,2004); //定义Date类对象d1 t1.display(d1); //调用t1中的display函数,实参是Date类对象d1 return 0; } 4, 将下面程序改为在类模板外定义各成员函数: #include <iostream> using namespace std; template<class numtype> //定义类模板 class Compare { public: Compare(numtype a,numtype b) { x=a;y=b; } numtype max( ) { return (x>y)?x:y; } numtype min( ) { return (x<y)?x:y; } private: numtype x,y; }; int main( ) { Compare<int> cmp1(3,7); //定义对象cmp1,用于两个整数的比较 cout<<cmp1.max( )<<″ is the Maximum of two integer numbers.″<<endl; cout<<cmp1.min( )<<″ is the Minimum of two integer numbers.″<<endl<<endl; Compare<float> cmp2(45.78,93.6); //定义对象cmp2,用于两个浮点数的比较 cout<<cmp2.max( )<<″ is the Maximum of two float numbers.″<<endl; cout<<cmp2.min( )<<″ is the Minimum of two float numbers.″<<endl<<endl; Compare<char> cmp3(′a′,′A′); //定义对象cmp3,用于两个字符的比较 cout<<cmp3.max( )<<″ is the Maximum of two characters.″<<endl; cout<<cmp3.min( )<<″ is the Minimum of two characters.″<<endl; return 0; } 5, 有两个矩阵a和b,均为2行3列,求两个矩阵的和。重载运算符“+”使之用于矩阵相加。如:c=a+b。重载插入运算符“<<”和流提取运算符“>>”,使之能用于该矩阵的输入和输出。 6, 利用类继承分别完成一个学生类、一个大学生类、一个本科生类,本科生类中包括了一个学生作为他的班长。在创建一个本科生对象时赋予他的全部信息,输出该本科生对象的全部信息。 7, 利用c++继承、多态虚函数、构造函数完成以下程序:设计人、老师、学生、大学生、研究生、大四学生等类、其主要属性自己定义,要求包括以下方法: 1) 构造函数,创建对象的主要信息 2) Display,显示每种类对象的主要信息 此外,要求每个类包含一个生日对象,其类型为Birthday类,学生类应该包含一个班主任对象,其类型为老师类。 三、实验要求  将程序源代码压缩后提交至学院FTP上对应实验和班级的目录中。  作业命名方式为:“学号姓名.rar”。  作业提交时间:下次实验课前提交。
Platform: | Size: 1255695 | Author: zhuchao0731@163.com | Hits:

[Software Engineeringiostream.hiiostream

Description: iostream.h和iiostream的区别iostream .h和iiostream的区别iostream .h和iiostream的区别-iostream.h and iiostream distinction and ii iostream.h ostream distinction iostream.h and iiostream distinction iostrea m.h and iiostream distinction iostream.h and the difference i iiostream ostream.h and iiostream distinction iostream.h and iiostre The distinction am
Platform: | Size: 1024 | Author: 包杰 | Hits:

[Otherp219__3__2

Description: #include<iostream> using namespace std class Point {public: Point(int a){x=a } ~Point(){cout< "execuing Point destructor"<<endl } private: int x } class Circle:public Point {public: Circle(int m,int n):Point(m){radius=m } ~Circle(){cout<<"execuing Circle destructor"<<radius<<endl } private: int radius } int main() {Point *p=new Circle(5,12) delete p system("pause") return 0 } -# Include <iostream> using namespace std class Point (public: Point (int a) (x = a) ~ Point () (cout < execuing Point destructor <<endl) private: int x) class Circle: public Point (public: Circle (int m, int n): Point (m) (radius = m) ~ Circle () (cout << execuing Circle destructor <<radius <<endl) private: int radius) int main () (Point* p = new Circle (5,12) delete p system ( pause ) return 0)
Platform: | Size: 1024 | Author: 华盛 | Hits:

[Otherdv

Description: #include<iostream> using namespace std class Point {public: Point(int a){x=a } ~Point(){cout< "execuing Point destructor"<<endl } private: int x } class Circle:public Point {public: Circle(int m,int n):Point(m){radius=m } ~Circle(){cout<<"execuing Circle destructor"<<radius<<endl } private: int radius } int main() {Point *p=new Circle(5,12) delete p system("pause") return 0 } -# Include <iostream> using namespace std class Point (public: Point (int a) (x = a) ~ Point () (cout < execuing Point destructor <<endl) private: int x) class Circle: public Point (public: Circle (int m, int n): Point (m) (radius = m) ~ Circle () (cout << execuing Circle destructor <<radius <<endl) private: int radius) int main () (Point* p = new Circle (5,12) delete p system ( pause ) return 0)
Platform: | Size: 2048 | Author: 华盛 | Hits:

[Mathimatics-Numerical algorithmsBP

Description: BP神经网络程序,C语言源代码 如下: #include "iostream.h" #include "iomanip.h" #include "stdlib.h" #include "math.h" #include "stdio.h" #include "time.h" #include "fstream.h" #define N 120 //学习样本个数 #define IN 3 //输入层神经元数目 #define HN 2 //隐层神经元数目 #define ON 2 //输出层神经元数目 #define Z 20000 //旧权值保存-》每次study的权值都保存下来 double P[IN] //单个样本输入数据 double T[ON] //单个样本教师数据 double U11[IN][HN] //输入层至第一隐层权值 double V[HN][ON] //隐层至输出层权值 double X1[HN] //第一隐层的输入 double Y[ON] //输出层的输入 double H1[HN] //第一隐层的输出 double O[ON] //输出层的输出 double YU_HN1[HN] //第一隐层的阈值 double YU_ON[ON] //输出层的阈值 double err_m[N] //第m个样本的总误差 double a //学习效率 double alpha //动量因子-BP net
Platform: | Size: 3072 | Author: 梅汉文 | Hits:

[Windows Develop10

Description: 实验目的:熟悉继承的概念,掌握定义并使用基类与派生类的方法 实验内容: (1) 程序清单:10.1 -#include <iostream.h> #include <iomanip.h> class Time { public: Time(int h = 0, int m = 0, int s = 0) { hrs = h, mins = m, secs = s } ~Time () { } void showTime(void)
Platform: | Size: 5120 | Author: huangzhiqiang | Hits:

[Windows Develop11

Description: 实验目的:熟悉虚函数及多态的产生 实验内容: (1)实验清单11.1-#include <iostream.h> #include <iomanip.h> class Time { public: Time(int h, int m, int s ) { hrs = h, mins = m, secs = s } ~Time () { } void showTime(void)
Platform: | Size: 5120 | Author: huangzhiqiang | Hits:

[matlabLave1

Description: #include <iostream> #include <stdlib.h> #include <string.h> using namespace std const kl = 4, kzs = 2, m = 6, n = 4, Error = 5 char *K[kl] = {{"01"},{"bB"},{"23456789ACDEFacdef"},{"hH"}} int A[m][n] = {{1,2,2,5}, {1,3,2,4},{2,2,2,4},{2,2,2,4},{5,5,5,5},{5,5,5,5}},
Platform: | Size: 842752 | Author: Andrew | Hits:

[Othergoods

Description: #include <iostream> #include <string> using namespace std class Goods {public: Goods(char *GoodsNum,string n,double p,int a) { strcpy(GoodsNumber,GoodsNum) GoodsName=n GoodsPrice=p GoodsAmount=a }//构造函数,商品的编号,名字,价格,数量 ~Goods(){} friend class Manager int quantity //声明购买数量 static float TotalPrice() //声明所购买商品的总价格 string get_GoodsName() const double get_GoodsPrice() const int get_GoodsAmount() void SetGoodsNumber(char*) //设置编号函数 void SetGoodsName(string) //设置姓名函数 void SetGoodsPrice(double pr) //设置价格函数 void SetGoodsAmount(int am) //设置数量函数 int SetGoodsGuaPeriod(int y,int m,int d){} //设置保质期函数 void PrintGuaPeriod() //输出保质期 private: char GoodsNumber[3] string GoodsName double GoodsPrice -#include <iostream> #include <string> using namespace std class Goods {public: Goods(char*GoodsNum,string n,double p,int a) { strcpy(GoodsNumber,GoodsNum) GoodsName=n GoodsPrice=p GoodsAmount=a }//构造函数,商品的编号,名字,价格,数量 ~Goods(){} friend class Manager int quantity //声明购买数量 static float TotalPrice() //声明所购买商品的总价格 string get_GoodsName() const double get_GoodsPrice() const int get_GoodsAmount() void SetGoodsNumber(char*) //设置编号函数 void SetGoodsName(string) //设置姓名函数 void SetGoodsPrice(double pr) //设置价格函数 void SetGoodsAmount(int am) //设置数量函数 int SetGoodsGuaPeriod(int y,int m,int d){} //设置保质期函数 void PrintGuaPeriod() //输出保质期 private: char GoodsNumber[3] string GoodsName double GoodsPrice
Platform: | Size: 1024 | Author: 熊舒予 | Hits:

[File Operateedatest

Description: 一个在MFC中使用IOStream IO实现高效文件流操作的小例子-a sample of highly efficient document IO access in MFC
Platform: | Size: 60416 | Author: 皮佳 | Hits:

[VC/MFCAnswersrar

Description: Its answers too , but it s eseps and it s answers 5) Дана квадратная матрица порядка N. В матрице вычислить среднее арифметическое положительных элементов, стоящих на главной диагонали. #include <iostream> using namespace std int mas[1001][1001] int main() { int n double m cin>>n for(int i=0 i<n i++) for(int i=0 i<n i++) cin>>mas[i][i] m=0 for(int i=0 i<n i++) m+=mas[i][i] cout<<m/n return 0 }-Its answers too , but it s eseps and it s answers 5) Дана квадратная матрица порядка N. В матрице вычислить среднее арифметическое положительных элементов, стоящих на главной диагонали. #include <iostream> using namespace std int mas[1001][1001] int main() { int n double m cin>>n for(int i=0 i<n i++) for(int i=0 i<n i++) cin>>mas[i][i] m=0 for(int i=0 i<n i++) m+=mas[i][i] cout<<m/n return 0 }
Platform: | Size: 259072 | Author: | Hits:

[Mathimatics-Numerical algorithmszuixiao

Description: 最小重量机器设计问题,回溯法和分支限定法-#include<iostream> using namespace std #define N 3 #define M 3 int w[N][M]={{1,2,3},{3,2,1},{2,2,2}} int c[N][M]={{1,2,3},{3,2,1},{2,2,2}} class machine {public:
Platform: | Size: 7168 | Author: 林莹莹 | Hits:

[e-languagenew

Description: 二维坐标系上有一些炸弹,每个炸弹有x,y坐标和爆炸后波及的范围r,这个r指的是跟自己曼哈顿距离r以内的点 就类似于扫雷那样,一个炸弹爆炸可能引起一片一片的炸弹炸出去 然后有一些询问,问点燃某个炸弹后会有多少个炸弹爆炸 已经炸过的就不算了 -#include <iostream> #include <vector> #include <algorithm> #include <cstdio> #include <cmath> #include <string> #include <cstring> #include <cmath> #include <ctime> using namespace std const int maxn = 110005 const int inf = 2000000005 struct NODE{ int y, dis NODE(){ } NODE(int _y, int _dis){ y = _y dis = _dis } bool operator <(const NODE &tmp)const{ if(y == tmp.y) return dis < tmp.dis return y < tmp.y } } struct POINT{ int x, y, dis POINT() { } POINT(int _x, int _y, int _dis){ x = _x y = _y dis = _dis } }df[maxn], myque[1111111] int n, m, hash[maxn], num vector<NODE>mygraph[maxn] void init(){ num = 0 for(int i = 0 i < maxn i++) mygraph[i].clear() } void readdata(){
Platform: | Size: 1024 | Author: 夏超 | Hits:

[ConsoleBANK

Description: 银行卡管理系统开户、存款、取款、修改密码、重置密码、销户 c-#include<iostream> #include<cstring> using namespace std class count { public: friend class ATM count (char Name[],char Num[],float Money,char Password[]) //初始化 protected: char* get_name() //返回姓名 char* get_num() //返回卡号 char* get_password() //返回密码 float get_money() //返回金额 void set_password(char pwd[]) //设置密码 void set_money(float m) //取钱
Platform: | Size: 2048 | Author: 丁探 | Hits:

CodeBus www.codebus.net