error C2660:函数不接受 1 个参数

cysolo 2011-11-03 11:47:08
#include "stdafx.h"
#include<iostream>
#include<stdio.h>
class Table
{
int x;
int y;
int z;
public:
void print(int x,int y,int z);
};
void Table::print(int x,int y,int z)
{
printf("%d*%d=%d",x,y,z);
}
class Table9:public Table
{
public:
void print();
};
void Table9::print()
{
int i,j;
int x,y,z;
for(i=1;i<10;i++)
{
for(j=1;j<i+1;j++)
{
x=i;
y=j;
z=i*j;
Table::print(y,x,z);
}
print("\n");
}
}

int _tmain(int argc, _TCHAR* argv[])
{
Table9 t_9;
t_9.print();
return 0;
}

错误提示如下:
1> moni3.cpp
1>d:\workspace\软件设计\moni3\moni3\moni3.cpp(37): error C2660: “Table9::print”: 函数不接受 1 个参数
1>
1>生成失败。
...全文
655 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhenghang_zdwxgd 2011-11-03
  • 打赏
  • 举报
回复
print("\n");这里错了
無_1024 2011-11-03
  • 打赏
  • 举报
回复
LS正解
蜥蜴枪王 2011-11-03
  • 打赏
  • 举报
回复
printf
无边1 2011-11-03
  • 打赏
  • 举报
回复
print("\n");
这里错了,是不是printf呀?
一叶之舟 2011-11-03
  • 打赏
  • 举报
回复
问题出到这儿了
void Table9::print()
{
int i,j;
int x,y,z;
for(i=1;i<10;i++)
{
for(j=1;j<i+1;j++)
{
x=i;
y=j;
z=i*j;
Table::print(y,x,z);
}
print("\n");-------问题出到这儿了

}
}
我想你的意思应该是
printf("\n");

64,637

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧