C++求教 。error C3867: “Stock::print”: 非标准语法;请使用 "&" 来创建指向成员的指针

Chen_XH0701 Chen_XH0701 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

#include<iostream>
#include<string>
using namespace std;
class Stock
{
public:
Stock(const char na[20],int q=1000,double p=8.98);

void print();


private:
char stockcode[20];
int quan;
double price;
};

Stock::Stock(const char na[20],int q,double p)
{
stockcode[20] = na[20];
quan = q;
price = p;
}
void Stock::print()
{
cout << this->stockcode[20] << this->quan << this->print << endl;
}



int main()
{
Stock S1("600001", 3000, 5.67);
S1.print();
Stock S2("600002");
S2.print();
return 0;
}
...全文

相关推荐

Professional.MFC.with.VC6

Contents Chapter 1: The Microsoft Developer Studio The Microsoft Developer Studio The Project Workspace Project Workspace Window Project Configurations Managing Complex Projects Project Settings Converting Projects Source Code Files Resource Scripts ResourceView Creating New Resources Identifying Resources Dialog Boxes String Tables Accelerator Tables Menus Icons, Bitmaps and Cursors Version Resources Custom Resources The Visual C++ Compiler Compiling on the Command Line The Foundation Classes MFC Source Code Header Files MFC Libraries Summary Chapter 2: The Wizards and The Gallery AppWizard Starting AppWizard Choosing Your Application's User Interface Selecting Database Support Adding Compound Document Support Embellishing Your User Interface Adding Advanced Features Miscellaneous Options Class Names One More Step Other Application Interfaces Choose Carefully! Compiling Your Application Precompiled Header Files ClassWizard Creating a New Class The .clw File The Browser Browser Files Browsing Shortcuts Components and Controls Gallery Summary Chapter 3: The Application Architecture Hierarchy The Application Framework Generating an Application with AppWizard Understanding the Generated Code CDocument and CView CWinApp CWinThread Locating Threads CCmdTarget Commands for Classes About Message Maps How are Message Maps Created? The BEGIN_MESSAGE_MAP() Macro Inside the Message Map Filling the Holes The END_MESSAGE_MAP() Macro Unfolding the Map There's No Sense of Obligation CObject Memory Management Debugging Support Serialization Run-time Type Information Your Own Classes and CObject The Big Picture: A New Life The WinMain() Function MFC's Message Pump Application Termination Summary Chapter 4: The Document/View Architecture Documents and Views Document/View Designs The Different Views Types of Document Document/View Consciousness What are Document Templates? CSingleDocTemplate S

hang313

llama.cpp本地推理三要素:量化、GGUF与CPU优化实战

大语言模型本地部署的核心在于推理引擎、模型压缩与格式规范的协同。llama.cpp作为纯C/C++编写的轻量级CPU推理引擎,摒弃Python和GPU依赖,通过AVX2/NEON指令集直通硬件,实现毫秒级启动与确定性延迟;量化(如Q4_K_M、Q5_K_M)并非简单降精度,而是采用分组量化策略,在4~5比特位宽下平衡内存占用、推理速度与生成质量;GGUF则是一种面向本地场景的自描述二进制容器,内嵌元数据、支持多量化版本共存与张量级加载控制。这三者共同构成资源受限设备(如16GB内存MacBook、Windo

anmei1912

C++自动售货机项目实战:面向对象编程与模块化设计详解

面向对象编程(OOP)是现代软件开发的核心范式,它通过封装、继承和多态三大特性,将现实世界实体抽象为类与对象,从而构建出结构清晰、易于维护的软件系统。其核心原理在于将数据与操作数据的方法绑定,实现高内聚、低耦合的设计。这种编程思想的技术价值在于显著提升代码的可复用性、可扩展性和可读性,是构建中大型项目的基石。在工程实践中,OOP广泛应用于业务系统、游戏开发、图形界面等场景。本文以C++实现自动售货机系统为例,深入解析如何运用面向对象思想和模块化设计,将商品管理、交易处理等离散功能封装成独立的类,并借助智能指

njit_peiyuan

C++网络编程实战:使用libcurl构建股票数据抓取工具

网络编程是计算机科学中实现程序间通信的核心技术,其底层基于TCP/IP协议栈,通过HTTP/HTTPS等应用层协议进行数据交换。libcurl作为一款高效、稳定的跨平台网络传输库,封装了复杂的协议细节,为C++开发者提供了简洁的接口。掌握libcurl不仅能实现可靠的数据抓取,还能深入理解HTTP请求、连接管理和错误处理等底层机制,这对于构建高性能数据采集系统至关重要。在金融科技、数据分析等领域,自动化获取和处理公开市场数据是常见需求,例如抓取深交所的股票基本概况信息。通过集成libcurl库,开发者可以编

weixin_30700977

黑龙江省哈尔滨新区矢量面数据-02坐标-geojson格式.json

哈尔滨新区区划面数据,geojson格式,02坐标

samLi0620
评论 1
收藏 已收藏
分享
返回顶部
Chen_XH0701
新手乐园 33,315 成员 41,769 内容