argc股票股价(argc股票价格)

c++编程题 //.cpp#include "stdafx.h"#include "file.h"#include using namespace std; A::A(){ int i; cout<<"Input the data of the array("<<<"): "; for(i= 0 ; i >a[i];

c++编程题

//.cpp#include "stdafx.h"#include "file.h"#include using namespace std; A::A(){ int i; cout<<"Input the data of the array("<<<"): \n"; for(i= 0 ; i >a[i];} greater=less=equal=0; } void A::Compare(A &t1, A &t2){ int i; int *p1,*p2; p1=t1.a,p2=t2.a; for(i=0 ; i p2[i]) ++greater; else if(p1[i] < p2[i] ) ++less; else ++equal; } } void A::Show(){ cout<<"The num of the greater: "<< cout<<"The num of the less: "<< cout<<"The num of the euqal: "<< } //.cpp #include "stdafx.h" #include "file.h" #include using namespace std; int _tmain(int argc, _TCHAR* argv[]) { A a,b; a.Compare(a,b); a.Show(); return 0; } //.h; class A { private: static const int size=10; int a[size]; int greater,equal,less; public: A(); void Compare(A &t1, A &t2); void Show(); // 第二题,你先要排序数组,再存放,这个很容易实现的,我晚上帮你做一下!

求解c++:构建一个类Stock,含字符数组stockcode[]及整型数据成员quan、双精度型数据成员price。

#include?//?const?unsigned?MAX_LEN?=?256;class?Stock{public://?这里用的初始化形参列表Stock(char?na[],?int?q=1000,?double?p=8.98)?:?stockcode(na),?quan(q),?price(p){}void?print(void){std::cout?<stockcode?<<?"?"?<<?quan?<<?"?"?<<?price?<<?std::endl;}private:char?*stockcode;//?或改为?char?stockcode[MAX_LEN];//?其中?MAX_LEN?定义在前为一常量:?const?unsigned?MAX_LEN?=?256;int?quan;double?price;};//?main?functionint?main(int?argc,?char?*argv[]){char?szTestString[]?=?"600001";//?It's?terminated?with?'\0'int?iTestInteger?=?3000;double?dTestDouble?=?5.67;Stock?stObj1(szTestString,?iTestInteger,?dTestDouble);Stock?stObj2(szTestString);stObj1.print();stObj2.print();return?0;}?//?end?main//?gcc?-?g++?4.5?下编译通过//?结果如图

关键词: 股价
本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 931614094@qq.com 举报,一经查实,本站将立刻删除。
argc股票股价(argc股票价格)文档下载: PDF DOC TXT