小编The*_*tor的帖子

C++和构造函数中的类

一个类可以有几个默认的构造函数吗?我想知道因为我认为任何东西都只能通过"默认"的定义只有一个默认功能,但我不太确定.

c++ constructor class

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

Python 2.7:如果代码块不起作用

我测试了以下程序,没有错误.但每当我输入"hangman"它时,都不会启动if名为的新语句代码块"if response_2".为什么不运行它?

    response_2 = raw_input("What would you like to play? Hangman or Word Guess?")
    if response_2 == ("Hangman", "hangman"):
        print "Running Hangman..."
        print "Catching Criminals..."
        print "Building Gallows..."
        print "Getting that one song boy from Pirate's of the Carribean"
    elif response_2 == ("Word_Guess", "word_guess", "word guess", "Word Guess", "Word guess", "word Guess", "Word_guess", "word_Guess"):
        print "Not completed yet"
Run Code Online (Sandbox Code Playgroud)

python if-statement python-2.7

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

C++中的无限循环

当我尝试运行这个程序时,我继续收到无限循环错误.谁能帮帮我,告诉我为什么?任何援助都将非常感激.谢谢!

    void Increment(int);
    int main()
    {
      int count = 1;
      while(count < 10)
      cout << "the number after " << count; //Increment function
      Increment(count); //count+1
      cout << " is " << count << endl;
      return 0;
    }
    void Increment (int nextNumber)
    {
      nextNumber++; //parameter +1
    }
Run Code Online (Sandbox Code Playgroud)

c++ loops

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

标签 统计

c++ ×2

class ×1

constructor ×1

if-statement ×1

loops ×1

python ×1

python-2.7 ×1