多文件编译1
来源:互联网 发布:ping的端口号 编辑:程序博客网 时间:2024/05/29 18:17
#include <iostream>
#include "stock00.h"
void Stock::acquire(const::string & co,long n,double pr)
{
company = co;
if(n<0)
{
std::cout<<"Number of shares can't be negative!"
<<company<<" shares set to 0.\n";
shares = 0;
}
else
shares = n;
share_val = pr;
set_tot();
}
void Stock::buy(long num,double price)
{
if (num<0)
{
std::cout<<"Number of shares purchased can't be negative"!
<<"Transaction is aborted.\n";
}
else
{
shares +=num;
share_val = price;
set_tot();
}
}
void Stock::sell(long num, double price)
{
using std::cout;
if (num<0)
{
cout<<"Number of shares purchased can't be negative"!
<<"Transaction is aborted.\n";
}
else if(num>shares)
{
cout<<"You can't sell more than you have! "
<<"Transaction is aborted.\n";
}
else
{
shares -=num;
share_val= price;
set_tot();
}
}
void Stock::update(double price)
{
share_val = price;
set_tot();
}
void Stock::show()
{
std::cout<<"Company: "<<company
<<" Shares: "<<shares <<'\n'
<<" Share Price: $"<<share_val
<<" Total Worth: $"<<total_val<<'\n';
}
#include "stock00.h"
void Stock::acquire(const::string & co,long n,double pr)
{
company = co;
if(n<0)
{
std::cout<<"Number of shares can't be negative!"
<<company<<" shares set to 0.\n";
shares = 0;
}
else
shares = n;
share_val = pr;
set_tot();
}
void Stock::buy(long num,double price)
{
if (num<0)
{
std::cout<<"Number of shares purchased can't be negative"!
<<"Transaction is aborted.\n";
}
else
{
shares +=num;
share_val = price;
set_tot();
}
}
void Stock::sell(long num, double price)
{
using std::cout;
if (num<0)
{
cout<<"Number of shares purchased can't be negative"!
<<"Transaction is aborted.\n";
}
else if(num>shares)
{
cout<<"You can't sell more than you have! "
<<"Transaction is aborted.\n";
}
else
{
shares -=num;
share_val= price;
set_tot();
}
}
void Stock::update(double price)
{
share_val = price;
set_tot();
}
void Stock::show()
{
std::cout<<"Company: "<<company
<<" Shares: "<<shares <<'\n'
<<" Share Price: $"<<share_val
<<" Total Worth: $"<<total_val<<'\n';
}
阅读全文
0 0
- 多文件编译1
- gcc多文件编译
- Hive多文件编译
- GCC多文件编译
- 多文件编译
- 多文件编译、链接
- 多文件的编译
- g++多文件编译
- c多文件编译
- 多文件编译
- 《关于多文件编译》
- 多文件编译 makefile
- javac 编译多文件
- linux多文件编译
- makefile多文件编译
- 多文件编译
- 宏、条件编译、编译多文件程序
- linux下c++文件编译、多文件编译、gdb调试
- 用PHP生成相对百分比水印
- IndexOutOfBoundsException
- 3天完成Neural Networks and Deep learning课程
- Qt程序无法启动,debug时提示During startup program exited with code 0xc0000135
- SQL注入
- 多文件编译1
- hdu3294---Girls' research
- MyBatis 笔记(四)——实体类属性和表字段的映射
- LeetCode 106. Construct Binary Tree from Inorder and Postorder Traversal
- Linux字符设备驱
- JVM_Java内存模型
- 面向对象的综合应用解析
- 人工神经网络:反向传播算法的数学基础(Part4)
- linux 下怎么设置终端快捷键