繁体   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