小编Jus*_*ker的帖子

如何在类中重写和格式化ToString()方法?

我搜索了Google和这个网站以找到答案.我也在课本中阅读过,但我仍然不明白它是如何应用的.

这就是我所知道的:

  • 它用于显示对象对自身的了解.

  • 它可以用于格式化输出关于它自己知道的内容.

  • 它必须在要使用的方法中被覆盖.

.net c# overriding tostring

6
推荐指数
1
解决办法
8671
查看次数

如何构思具有三维以上的数组?

我刚刚学习了数组,但无法概念化超过三维的数组.

c++ arrays

5
推荐指数
1
解决办法
1316
查看次数

我想从这段代码中删除使用命名空间std,但我不确定所有需要以std ::为前缀的内容

我想删除使用命名空间std,但我不知道所有需要加前缀.

 #include <iostream>
 #include "PlayingCard.h"

 using namespace std;

 PlayingCard makeValidCard(int value, int suit);

 int main()
{
// Create a playing card
PlayingCard card1;


// Test the default constructor and GetCardCode
cout << "Testing default constructor. Expect card code to be 00\n card code is :";
cout << card1.getCardCode() << endl << endl;


// Test the setter and getter
cout << "Seting card to 'AH' using SetValue and SetSuit" << endl;
card1.setCard('A', 'H');
cout << "GetValue returns :" << card1.getValue() << …
Run Code Online (Sandbox Code Playgroud)

c++ namespaces

3
推荐指数
1
解决办法
2838
查看次数

我的课本说数组是用const变量设置的.当我使用非const变量时,我可能会遇到哪些问题?

我正在阅读的C++书告诉我们,数组将使用常量变量设置,但我想让用户输入指示数组的大小,并且它有效.是否有我应该担心的问题.

c++ arrays

1
推荐指数
1
解决办法
115
查看次数

"错误:从'int'转换为非标量类型'COORD'请求"

尝试在code :: blocks中编译以下代码时,我遇到了这个单独的错误.
错误发生了8行.

#include <iostream>
#include <windows.h>
using namespace std;

int main()
{
HANDLE screen = GetStdHandle(STD_OUTPUT_HANDLE);
COORD pos = (40, 3);
SetConsoleCursorPosition(screen, pos);
cout << "O" << endl;
Sleep(500);

for (int tossIt = 1; tossIt <= 3; tossIt++)
{
    while (pos.Y <= 20)
    {
        SetConsoleCursorPosition(screen, pos);
        cout << "|" << endl;
        pos.Y++;
        SetConsoleCursorPosition(screen, pos);
        cout << "O" << endl;
        Sleep(100);
    }
    while (pos.Y > 3)
    {
        SetConsoleCursorPosition(screen, pos);
        cout << " " << endl;
        pos.Y--;
        SetConsoleCursorPosition(screen, pos);
        cout …
Run Code Online (Sandbox Code Playgroud)

c++

0
推荐指数
1
解决办法
2022
查看次数

标签 统计

c++ ×4

arrays ×2

.net ×1

c# ×1

namespaces ×1

overriding ×1

tostring ×1