簡體   English   中英

Code :: Blocks-Linux-即使“ main.cpp”文件中沒有該文件,也會打印“ Hello World”

[英]Code::Blocks - Linux - prints “Hello World” even though it isn't in the “main.cpp” file

我最近啟動了一些項目來幫助我學習C ++,我正在創建一個程序,該程序允許用戶輸入分數/ 100,代碼如下:

#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main (gradeScore)
{
    int gradeScore
    cout << "Enter your grade score out of 100"
    cin >> gradeScore

    if (gradeScore == 100)
    {
        cout << "Well done! You have achieved a perfect score!.."
    {
}

我嘗試編譯它只是為了確保它到目前為止可以正常工作,但是,它打開了終端並打印

Hello World! 

Process returned 0 (0x0)    execution time : 0.013 s
Press ENTER to continue.

我不確定該怎么做,項目中的任何地方都沒有包含字符串“ Hello World”的地方。 有人可以幫我嗎? 我只希望能夠這樣無障礙地進行我的學習。

我正在使用Code :: Blocks 13.12 rev 9501(2013-12-25 18:25:45)gcc 4.8.2 Linux / unicode-32位(不確定是否有幫助)

多謝你們。

我要感謝您的建議和幫助,我敢肯定,無聊的時候總是看到這樣的問題。

我已經解決了問題,結果發現解決方案非常簡單:我刪除了該項目,制作了一個新項目,打開main.cpp文件,發現坐在文件上的這個厚臉皮的小蟲子:

#include <iostream>
using namespace std; 

int main()
{
    cout << "Hello World!" <<endl;
}

我刪除了它,並將原始程序更正為:

#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;

int main()
{
    int gradeScore;
    cout << "Input test score out of 100:";
    cin >> gradeScore;

    if (gradeScore == 100)
    {
        cout << "Congratulations! You achieved a perfect score" << endl; 
    {
}

再次感謝您的耐心等待! 我保證我正在嘗試哈哈哈!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM