跳过初学者C ++函数:没有错误

时间:2016-03-17 19:49:18

标签: c++ function

我不知道这里发生了什么。我没有得到任何错误,程序命中第一个函数,然后跳过返回0.这是我正在做的练习。用户将在苏打水机中输入一个号码,然后他们会收到他们选择的项目。任何帮助将不胜感激!

Set objCollection = IE.document.getElementsByTagName("input")

I = 0
While I < objCollection.Length
    If objCollection(I).Name = "SELECTED" Then
        objCollection(I).Value = "12345"
    End If
    If objCollection(I).Type = "submit" And objCollection(I).Name = "View" Then ' submit button if found and set
        Set objElement = objCollection(I)
    End If
    I = I + 1
Wend
objElement.Click

WaitIE

2 个答案:

答案 0 :(得分:0)

int processSelection();

这是一个功能声明。它告诉编译器有一个函数processSelection不带参数并返回int - 但编译器已经知道了。

调用该函数,您可以写:

processSelection();

dropSoda相同。

答案 1 :(得分:0)

您的主要功能是声明功能,而不是呼叫它们。

int _tmain(int argc, _TCHAR* argv[])
{
    Menu();  // menu called
    // declare a function `processSelection` taking no arguments and returning an int
    int processSelection(); 
    // again, functoin declaration
    void dropSoda();
    return 0;
}

要修复,请按照调用Menu()

的方式调用这两个函数
int _tmain(int argc, _TCHAR* argv[])
{
    Menu();
    processSelection(); 
    dropSoda();
    return 0;
}