【发布时间】:2016-10-20 19:46:46
【问题描述】:
请帮助我是 C++ 初学者 我找不到合适的解决方案。我还在这个问题中添加了错误图片。请给我正确的解决方案。
#include <iostream>
#include <conio.h>
class test
{
int no;
static int count;
public:
void getval (int);
void dispcount (void);
};
void test:: getval(int x)
{
no = x;
cout << "Number = " << no << endl;;
count++;
}
void test::dispcount(void)
{
cout << "Counten = " << count;
}
int test::count;
int main()
{
test t1,t2,t3;
t1.dispcount();
t2.dispcount();
t3.dispcount();
t1.getval(100);
t2.getval(200);
t3.getval(300);
t1.dispcount();
t2.dispcount();
t3.dispcount();
getch();
return 0;
}
【问题讨论】:
-
为了找到合适的解决方案,您需要找出问题所在。你这样做了吗?
-
不要在问题中包含难以阅读的图像,例如,在您的问题中。您必须以纯文本形式包含错误消息。作为 C++ 初学者,您需要学习的最佳技能是如何以其他人都能理解您的方式交流您的问题。
-
使用
std::cout << ...。 -
你没有放图片,无论如何你应该将完整的错误信息发布为文本而不是图像
-
“图片已添加”,因为人们告诉您不要发布图片。淘气。
标签: c++ class namespaces