抽象接口(syntax erro和syntax erro) 题目Tao Bao
来源:互联网 发布:网络主播经纪人 编辑:程序博客网 时间:2024/05/01 09:34
1、奇葩错误
26 C:\Dev-Cpp\main.cpp syntax error at end of input
3 C:\Dev-Cpp\printItem.h using-declaration for non-member at class scope
这两个奇葩错误有可能是因为少了花括号(出错会出在其他文件里,但花括号是本程序里少)
2、标程:
#ifndef Source_H#define Source_H #include "Taobao.h" class SortByPrice : public SortInterface { public: virtual void DoSort(TaoBaoItem item[], int size) { for (int i = 0; i < size; i++) for (int j = 0; j < size - 1 -i; j++) { if (item[j+1].price > item[j].price) { TaoBaoItem taobao = item[j+1]; //结构体item可以直接拿来交换,不用分别交换price和sales item[j+1] = item[j]; item[j] = taobao; } } for (int i = 0; i < size; i++) for (int j = 0; j < size - 1 -i; j++) { if (item[j+1].price == item[j].price && item[j+1].volume_of_sales > item[j].volume_of_sales) { TaoBaoItem taobao = item[j+1]; item[j+1] = item[j]; item[j] = taobao; } } }};3、为了能实现不同的排序方式,抽象出了一个接口出来(作为基类):
class SortInterface { public: virtual ~SortInterface() {} virtual void DoSort(TaoBaoItem item[], int size) = 0;};
再分别用两种排序来继承它
0 0
- 抽象接口(syntax erro和syntax erro) 题目Tao Bao
- Command line option syntax erro Type command / ? for help 错误解决
- (zt)erro code
- 抽象语法树(Abstract Syntax Tree)
- erro link 2001
- code erro tip
- L6050U compile erro
- 关于runtime erro
- 关于Runtine erro!
- ERRO:序列不存在
- ASN.1抽象语法标记(Abstract Syntax Notation One)
- 语法分析(syntax analysis)
- Grub erro 17的解决方法
- grails Erro type :loadXML 错误
- Compiling erro C2061 ( identifier 'STAT_CHUNK')
- ajax中erro调试错误信息
- Session'app':Erro Installing APK
- syntax和semantics的区别
- 偶遇
- DBus学习资料
- Android基础第二天
- 智能指针(三):unique_ptr使用简介
- Leetcode_integer-to-roman
- 抽象接口(syntax erro和syntax erro) 题目Tao Bao
- 思科大中华区副总裁殷康:云计算已进入Intercloud时代
- 菜鸟记录学习java的点点滴滴之几个小错误
- GCC 编译标准-std=的设置方法
- sql文章阅读笔记二
- HDU3622 二分几何+2-SAT
- qt 处理ORACLE的AMERICAN_AMERICA.US7ASCII编码
- Json-lib简单使用
- 22、文字截图把背景变透明