Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Programming Language

Qt Programming Language

Scheduled Pinned Locked Moved Unsolved General and Desktop
331 Posts 17 Posters 307.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mrjjM mrjj

    @LeLev
    Hi
    She is using a screen reader so I think its easier for her to use the same thread.

    ODБOïO Offline
    ODБOïO Offline
    ODБOï
    wrote on last edited by
    #310

    @mrjj ah ok! my bad

    1 Reply Last reply
    1
    • jsulmJ jsulm

      @Annabelle Looks good, it works

      A Offline
      A Offline
      Annabelle
      wrote on last edited by
      #311

      @jsulm said in Qt Programming Language:

      @Annabelle Looks good, it works

      Cool-ee-o! So what do I do next?

      aha_1980A 1 Reply Last reply
      0
      • A Annabelle

        @jsulm said in Qt Programming Language:

        @Annabelle Looks good, it works

        Cool-ee-o! So what do I do next?

        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #312

        @Annabelle: Congrats, your program is compiling and running.

        However, it does not seem to output any useful yet.

        So the next thing would be to actually make your program to output "Hello World!" (or any other greeting you can think of).

        Good luck!

        Qt has to stay free or it will die.

        A 1 Reply Last reply
        2
        • aha_1980A aha_1980

          @Annabelle: Congrats, your program is compiling and running.

          However, it does not seem to output any useful yet.

          So the next thing would be to actually make your program to output "Hello World!" (or any other greeting you can think of).

          Good luck!

          A Offline
          A Offline
          Annabelle
          wrote on last edited by
          #313

          @aha_1980 said in Qt Programming Language:

          @Annabelle: Congrats, your program is compiling and running.

          However, it does not seem to output any useful yet.

          So the next thing would be to actually make your program to output "Hello World!" (or any other greeting you can think of).

          Good luck!

          Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!

          aha_1980A JonBJ 2 Replies Last reply
          0
          • A Annabelle

            @aha_1980 said in Qt Programming Language:

            @Annabelle: Congrats, your program is compiling and running.

            However, it does not seem to output any useful yet.

            So the next thing would be to actually make your program to output "Hello World!" (or any other greeting you can think of).

            Good luck!

            Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by
            #314

            Hi @Annabelle,

            Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!

            Yes, it is. Do you have this output somewhere on your screen? In the screenshots you provided, I didn't see it.

            If you already have that, then the next steps could be:

            1. Print "Hello World" ten times, with an upcounting number appended, like:
            Hello World 1
            Hello World 2
            Hello World 3
            ...
            Hello World 10
            
            1. Ask the user for his name, and greet him. That could look like this:
            Hello, what's your name?
            Luke
            Nice to meet you, Luke!
            

            That would then almost be a complete program, taking an input and providing an output. Only the data processing is missing - but we can add that later.

            Regards

            Qt has to stay free or it will die.

            1 Reply Last reply
            2
            • A Annabelle

              @aha_1980 said in Qt Programming Language:

              @Annabelle: Congrats, your program is compiling and running.

              However, it does not seem to output any useful yet.

              So the next thing would be to actually make your program to output "Hello World!" (or any other greeting you can think of).

              Good luck!

              Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #315

              @Annabelle
              Hi Annabelle.

              Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!

              As I mentioned earlier, we cannot see your source code in the screenshots. You need to open your source file so that we at least can see its contents.

              If you were currently editing your .cpp file's content, I assume you have to have it open, e.g. so your screen reader can read its content. Can you get to that state and post screenshot?

              A 2 Replies Last reply
              1
              • JonBJ JonB

                @Annabelle
                Hi Annabelle.

                Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!

                As I mentioned earlier, we cannot see your source code in the screenshots. You need to open your source file so that we at least can see its contents.

                If you were currently editing your .cpp file's content, I assume you have to have it open, e.g. so your screen reader can read its content. Can you get to that state and post screenshot?

                A Offline
                A Offline
                Annabelle
                wrote on last edited by
                #316

                @JonB said in Qt Programming Language:

                @Annabelle
                Hi Annabelle.

                Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!

                As I mentioned earlier, we cannot see your source code in the screenshots. You need to open your source file so that we at least can see its contents.

                If you were currently editing your .cpp file's content, I assume you have to have it open, e.g. so your screen reader can read its content. Can you get to that state and post screenshot?

                How's this?
                0_1564026008478_a78a4405-c20a-4616-b15e-09d67a7e7238-image.png

                1 Reply Last reply
                0
                • JonBJ JonB

                  @Annabelle
                  Hi Annabelle.

                  Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!

                  As I mentioned earlier, we cannot see your source code in the screenshots. You need to open your source file so that we at least can see its contents.

                  If you were currently editing your .cpp file's content, I assume you have to have it open, e.g. so your screen reader can read its content. Can you get to that state and post screenshot?

                  A Offline
                  A Offline
                  Annabelle
                  wrote on last edited by
                  #317

                  @JonB said in Qt Programming Language:

                  @Annabelle
                  Hi Annabelle.

                  Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!

                  As I mentioned earlier, we cannot see your source code in the screenshots. You need to open your source file so that we at least can see its contents.

                  If you were currently editing your .cpp file's content, I assume you have to have it open, e.g. so your screen reader can read its content. Can you get to that state and post screenshot?

                  How about this one.
                  0_1564026313636_ece6e8dd-5eed-4e06-92f8-909491c8ad37-image.png

                  aha_1980A JonBJ 2 Replies Last reply
                  0
                  • A Annabelle

                    @JonB said in Qt Programming Language:

                    @Annabelle
                    Hi Annabelle.

                    Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!

                    As I mentioned earlier, we cannot see your source code in the screenshots. You need to open your source file so that we at least can see its contents.

                    If you were currently editing your .cpp file's content, I assume you have to have it open, e.g. so your screen reader can read its content. Can you get to that state and post screenshot?

                    How about this one.
                    0_1564026313636_ece6e8dd-5eed-4e06-92f8-909491c8ad37-image.png

                    aha_1980A Offline
                    aha_1980A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on last edited by
                    #318

                    Hi @Annabelle,

                    Ok, that shows us your current main function. So far so good!

                    What you did there, is called hardcoding. That means, your program does greet you, but it can only great you and no one else.

                    Before we proceed I have an important question. When you run your program, do you get the greeting output on some window? That is an important point, because that's why we do all this programming, right?

                    And once that is working the task is really, to not only greet Annabelle, but also Vladimir, Julia, Rodriguez, and Sabrina, ...

                    To do this, you will need to get some input into your program, and store the input for further processing.

                    Regards

                    Qt has to stay free or it will die.

                    1 Reply Last reply
                    1
                    • A Annabelle

                      @JonB said in Qt Programming Language:

                      @Annabelle
                      Hi Annabelle.

                      Isn't that what the line, "std::cout << "Hello, World!"; is supposed to do? I'm confused!

                      As I mentioned earlier, we cannot see your source code in the screenshots. You need to open your source file so that we at least can see its contents.

                      If you were currently editing your .cpp file's content, I assume you have to have it open, e.g. so your screen reader can read its content. Can you get to that state and post screenshot?

                      How about this one.
                      0_1564026313636_ece6e8dd-5eed-4e06-92f8-909491c8ad37-image.png

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by JonB
                      #319

                      @Annabelle
                      Hi Annabelle,

                      Yep, the latest screenshot allows us to see your code! You'll want to show us that when you have a question about your code. (At a later date if the code gets too long to show in that screen we'll have to do something else, but that can wait for now.)

                      A couple of points:

                      1. Earlier you had a compilation error, about a funny character in the code, at line #9, I believe. It seems to be compiling now, I think, so you may have dealt with that. But your lines 9, 10 and 11 are just an open-curly-brace, a blank line, and then a close-curly-brace. These do nothing, and are not useful in your code. Delete lines 9 to 11 inclusive, or replace them with a single blank line which looks nice to us (a gap between the #include line and the start of your main() function), but you may not be fussed about blank lines/layout.

                      2. As @aha_1980 has written, your program produces some lines of output sent to what is called "stdout" via your std::cout lines. This should produce some output somewhere (which can presumably be read to you), but we cannot see where that might be. The development environment you are using, known as an "IDE", is in charge of where that goes.

                      What we can see is that the "Build log" tab you are displaying, which shows the results of compiling, does not seem to include this output. Maybe there is a different tab at the bottom, scrolled off to the right, which has some sort of "Output" pane to send to? Or --- and it gets confusing now, I am only guessing --- the "Build log" seems to be showing that when your IDE runs your "Hello World" program it does it by passing it to an internal CodeBlocks or CodeRunner program named cb_console_runner.exe. Note the use of "console" there. It may be that opens up a "console" (like an output window) when it runs to display your program's output, and that might automatically go away when your program ends, I don't know.

                      EDIT I think I now understand your IDE is Code::Blocks (not CodeRunner). I have done some brief Googling, which you may want to do, for CodeBlocks stdout. There are indeed various hits about "how do I get to see the output from my program from CodeBlocks".

                      If we take, say, https://stackoverflow.com/questions/28878911/how-can-i-get-console-output-in-code-block-ide, the guy there has a similar program to yours. One thing we are told is

                      Click on build->run or hit Ctrl+F10 and a new CMD Window should pop up, showing you your "Hello world!".

                      So that tells us it does indeed need to open a separate command/output window to send the output to. Does your screenreader tell you this window gets opened or read its content?

                      Then the last response there says:

                      Please include getchar() in the function before return statement. This happens because the computer is executing your program and doesn't wait for you to see the output. Including getchar(), at the end mandates it to wait for an input & in the meanwhile you can observe your output

                      I did wonder if this might be the case. Because your program outputs some lines and then simply terminates, it may well be that this console output window pops up when you run your program, shows the lines, and then immediately exits. So you/your screenreader may know nothing about it. You need to cause the program to "pause" before it exists so you can examine this output window.

                      I'm not a C++ expert, but I believe you should try inserting the following two lines after all your std::cout lines and immediately before your return 0; line:

                      std::string input;
                      std::getline(std::cin, input);
                      

                      If you do that, when you run your program I believe/hope it will not immediately run to exit as it does now. You will have to "find" that new output window and click the Enter key in it before it exits and then your program completes. Hopefully you can then get your screenreader to read it out before you press the key?

                      A 1 Reply Last reply
                      4
                      • JonBJ JonB

                        @Annabelle
                        Hi Annabelle,

                        Yep, the latest screenshot allows us to see your code! You'll want to show us that when you have a question about your code. (At a later date if the code gets too long to show in that screen we'll have to do something else, but that can wait for now.)

                        A couple of points:

                        1. Earlier you had a compilation error, about a funny character in the code, at line #9, I believe. It seems to be compiling now, I think, so you may have dealt with that. But your lines 9, 10 and 11 are just an open-curly-brace, a blank line, and then a close-curly-brace. These do nothing, and are not useful in your code. Delete lines 9 to 11 inclusive, or replace them with a single blank line which looks nice to us (a gap between the #include line and the start of your main() function), but you may not be fussed about blank lines/layout.

                        2. As @aha_1980 has written, your program produces some lines of output sent to what is called "stdout" via your std::cout lines. This should produce some output somewhere (which can presumably be read to you), but we cannot see where that might be. The development environment you are using, known as an "IDE", is in charge of where that goes.

                        What we can see is that the "Build log" tab you are displaying, which shows the results of compiling, does not seem to include this output. Maybe there is a different tab at the bottom, scrolled off to the right, which has some sort of "Output" pane to send to? Or --- and it gets confusing now, I am only guessing --- the "Build log" seems to be showing that when your IDE runs your "Hello World" program it does it by passing it to an internal CodeBlocks or CodeRunner program named cb_console_runner.exe. Note the use of "console" there. It may be that opens up a "console" (like an output window) when it runs to display your program's output, and that might automatically go away when your program ends, I don't know.

                        EDIT I think I now understand your IDE is Code::Blocks (not CodeRunner). I have done some brief Googling, which you may want to do, for CodeBlocks stdout. There are indeed various hits about "how do I get to see the output from my program from CodeBlocks".

                        If we take, say, https://stackoverflow.com/questions/28878911/how-can-i-get-console-output-in-code-block-ide, the guy there has a similar program to yours. One thing we are told is

                        Click on build->run or hit Ctrl+F10 and a new CMD Window should pop up, showing you your "Hello world!".

                        So that tells us it does indeed need to open a separate command/output window to send the output to. Does your screenreader tell you this window gets opened or read its content?

                        Then the last response there says:

                        Please include getchar() in the function before return statement. This happens because the computer is executing your program and doesn't wait for you to see the output. Including getchar(), at the end mandates it to wait for an input & in the meanwhile you can observe your output

                        I did wonder if this might be the case. Because your program outputs some lines and then simply terminates, it may well be that this console output window pops up when you run your program, shows the lines, and then immediately exits. So you/your screenreader may know nothing about it. You need to cause the program to "pause" before it exists so you can examine this output window.

                        I'm not a C++ expert, but I believe you should try inserting the following two lines after all your std::cout lines and immediately before your return 0; line:

                        std::string input;
                        std::getline(std::cin, input);
                        

                        If you do that, when you run your program I believe/hope it will not immediately run to exit as it does now. You will have to "find" that new output window and click the Enter key in it before it exits and then your program completes. Hopefully you can then get your screenreader to read it out before you press the key?

                        A Offline
                        A Offline
                        Annabelle
                        wrote on last edited by
                        #320

                        @jonb said in Qt Programming Language:

                        @Annabelle
                        Hi Annabelle,

                        Yep, the latest screenshot allows us to see your code! You'll want to show us that when you have a question about your code. (At a later date if the code gets too long to show in that screen we'll have to do something else, but that can wait for now.)

                        A couple of points:

                        1. Earlier you had a compilation error, about a funny character in the code, at line #9, I believe. It seems to be compiling now, I think, so you may have dealt with that. But your lines 9, 10 and 11 are just an open-curly-brace, a blank line, and then a close-curly-brace. These do nothing, and are not useful in your code. Delete lines 9 to 11 inclusive, or replace them with a single blank line which looks nice to us (a gap between the #include line and the start of your main() function), but you may not be fussed about blank lines/layout.

                        2. As @aha_1980 has written, your program produces some lines of output sent to what is called "stdout" via your std::cout lines. This should produce some output somewhere (which can presumably be read to you), but we cannot see where that might be. The development environment you are using, known as an "IDE", is in charge of where that goes.

                        What we can see is that the "Build log" tab you are displaying, which shows the results of compiling, does not seem to include this output. Maybe there is a different tab at the bottom, scrolled off to the right, which has some sort of "Output" pane to send to? Or --- and it gets confusing now, I am only guessing --- the "Build log" seems to be showing that when your IDE runs your "Hello World" program it does it by passing it to an internal CodeBlocks or CodeRunner program named cb_console_runner.exe. Note the use of "console" there. It may be that opens up a "console" (like an output window) when it runs to display your program's output, and that might automatically go away when your program ends, I don't know.

                        EDIT I think I now understand your IDE is Code::Blocks (not CodeRunner). I have done some brief Googling, which you may want to do, for CodeBlocks stdout. There are indeed various hits about "how do I get to see the output from my program from CodeBlocks".

                        If we take, say, https://stackoverflow.com/questions/28878911/how-can-i-get-console-output-in-code-block-ide, the guy there has a similar program to yours. One thing we are told is

                        Click on build->run or hit Ctrl+F10 and a new CMD Window should pop up, showing you your "Hello world!".

                        So that tells us it does indeed need to open a separate command/output window to send the output to. Does your screenreader tell you this window gets opened or read its content?

                        Then the last response there says:

                        Please include getchar() in the function before return statement. This happens because the computer is executing your program and doesn't wait for you to see the output. Including getchar(), at the end mandates it to wait for an input & in the meanwhile you can observe your output

                        I did wonder if this might be the case. Because your program outputs some lines and then simply terminates, it may well be that this console output window pops up when you run your program, shows the lines, and then immediately exits. So you/your screenreader may know nothing about it. You need to cause the program to "pause" before it exists so you can examine this output window.

                        I'm not a C++ expert, but I believe you should try inserting the following two lines after all your std::cout lines and immediately before your return 0; line:

                        std::string input;
                        std::getline(std::cin, input);
                        

                        If you do that, when you run your program I believe/hope it will not immediately run to exit as it does now. You will have to "find" that new output window and click the Enter key in it before it exits and then your program completes. Hopefully you can then get your screenreader to read it out before you press the key?

                        Here's a screenshot of what my project looks like now.
                        0_1564177921376_fab80b48-d5dd-4d3a-b0f7-08a520e8af57-image.png
                        And here's a screenshot of the code.
                        0_1564177954379_79727094-32ac-4da2-a426-6e8d36889568-image.png

                        JonBJ aha_1980A 2 Replies Last reply
                        2
                        • A Annabelle

                          @jonb said in Qt Programming Language:

                          @Annabelle
                          Hi Annabelle,

                          Yep, the latest screenshot allows us to see your code! You'll want to show us that when you have a question about your code. (At a later date if the code gets too long to show in that screen we'll have to do something else, but that can wait for now.)

                          A couple of points:

                          1. Earlier you had a compilation error, about a funny character in the code, at line #9, I believe. It seems to be compiling now, I think, so you may have dealt with that. But your lines 9, 10 and 11 are just an open-curly-brace, a blank line, and then a close-curly-brace. These do nothing, and are not useful in your code. Delete lines 9 to 11 inclusive, or replace them with a single blank line which looks nice to us (a gap between the #include line and the start of your main() function), but you may not be fussed about blank lines/layout.

                          2. As @aha_1980 has written, your program produces some lines of output sent to what is called "stdout" via your std::cout lines. This should produce some output somewhere (which can presumably be read to you), but we cannot see where that might be. The development environment you are using, known as an "IDE", is in charge of where that goes.

                          What we can see is that the "Build log" tab you are displaying, which shows the results of compiling, does not seem to include this output. Maybe there is a different tab at the bottom, scrolled off to the right, which has some sort of "Output" pane to send to? Or --- and it gets confusing now, I am only guessing --- the "Build log" seems to be showing that when your IDE runs your "Hello World" program it does it by passing it to an internal CodeBlocks or CodeRunner program named cb_console_runner.exe. Note the use of "console" there. It may be that opens up a "console" (like an output window) when it runs to display your program's output, and that might automatically go away when your program ends, I don't know.

                          EDIT I think I now understand your IDE is Code::Blocks (not CodeRunner). I have done some brief Googling, which you may want to do, for CodeBlocks stdout. There are indeed various hits about "how do I get to see the output from my program from CodeBlocks".

                          If we take, say, https://stackoverflow.com/questions/28878911/how-can-i-get-console-output-in-code-block-ide, the guy there has a similar program to yours. One thing we are told is

                          Click on build->run or hit Ctrl+F10 and a new CMD Window should pop up, showing you your "Hello world!".

                          So that tells us it does indeed need to open a separate command/output window to send the output to. Does your screenreader tell you this window gets opened or read its content?

                          Then the last response there says:

                          Please include getchar() in the function before return statement. This happens because the computer is executing your program and doesn't wait for you to see the output. Including getchar(), at the end mandates it to wait for an input & in the meanwhile you can observe your output

                          I did wonder if this might be the case. Because your program outputs some lines and then simply terminates, it may well be that this console output window pops up when you run your program, shows the lines, and then immediately exits. So you/your screenreader may know nothing about it. You need to cause the program to "pause" before it exists so you can examine this output window.

                          I'm not a C++ expert, but I believe you should try inserting the following two lines after all your std::cout lines and immediately before your return 0; line:

                          std::string input;
                          std::getline(std::cin, input);
                          

                          If you do that, when you run your program I believe/hope it will not immediately run to exit as it does now. You will have to "find" that new output window and click the Enter key in it before it exits and then your program completes. Hopefully you can then get your screenreader to read it out before you press the key?

                          Here's a screenshot of what my project looks like now.
                          0_1564177921376_fab80b48-d5dd-4d3a-b0f7-08a520e8af57-image.png
                          And here's a screenshot of the code.
                          0_1564177954379_79727094-32ac-4da2-a426-6e8d36889568-image.png

                          JonBJ Offline
                          JonBJ Offline
                          JonB
                          wrote on last edited by JonB
                          #321

                          @annabelle
                          There you are, you've found the command window it sends its output to, and made it wait to exit till you press Enter, so you have time to read the output!

                          However, I don't think your output can correspond exactly to what you have shown as your current program code in the screenshot? Two reasons:

                          • Your output shows only Hello world!. But your code has 4 lines of output statements, we are not seeing the last 3 of them.

                          • At line 18 you have the close-curly-brace to mark the end of your main() function definition. But I do not see the open-curly-brace to start the block? You should have an open-curly-brace after line 10 (int main()) and before line 11? That should mean the code you show does not compile.

                          Your Build log window shows it running the Hello World.exe executable but it does not show it compiling the source. Do you actually have an old Hello World.exe executable sitting there from a previous, successful build against different source, which is what it is running?

                          EDIT Aha! I can see in your IDE the title of the tab you are showing reads:

                          *Hello Word!.cpp
                          

                          Note that * (asterisk) at the start of the filename. Editors do that to indicate that you have altered the text of the file in the editor pane but you have not saved it back to the file. That means the code as you show it has not been passed to the compiler, and it is indeed running the executable (no re-compilation) that was last successfully compiled. If you make/made the open-curly-brace change I said then this code would compile, and produce 4 lines of output.

                          BTW: I'm not sure, but when I looked for you at what people were saying about this output window from CodeBlocks I think someone was claiming that in one of its "settings" (available somewhere inside the IDE) there is some kind of "Pause [for key press] at end of program before closing command output window". If you can find that you could avoid having to put the std::getline() at the end of your program.

                          1 Reply Last reply
                          1
                          • A Annabelle

                            @jonb said in Qt Programming Language:

                            @Annabelle
                            Hi Annabelle,

                            Yep, the latest screenshot allows us to see your code! You'll want to show us that when you have a question about your code. (At a later date if the code gets too long to show in that screen we'll have to do something else, but that can wait for now.)

                            A couple of points:

                            1. Earlier you had a compilation error, about a funny character in the code, at line #9, I believe. It seems to be compiling now, I think, so you may have dealt with that. But your lines 9, 10 and 11 are just an open-curly-brace, a blank line, and then a close-curly-brace. These do nothing, and are not useful in your code. Delete lines 9 to 11 inclusive, or replace them with a single blank line which looks nice to us (a gap between the #include line and the start of your main() function), but you may not be fussed about blank lines/layout.

                            2. As @aha_1980 has written, your program produces some lines of output sent to what is called "stdout" via your std::cout lines. This should produce some output somewhere (which can presumably be read to you), but we cannot see where that might be. The development environment you are using, known as an "IDE", is in charge of where that goes.

                            What we can see is that the "Build log" tab you are displaying, which shows the results of compiling, does not seem to include this output. Maybe there is a different tab at the bottom, scrolled off to the right, which has some sort of "Output" pane to send to? Or --- and it gets confusing now, I am only guessing --- the "Build log" seems to be showing that when your IDE runs your "Hello World" program it does it by passing it to an internal CodeBlocks or CodeRunner program named cb_console_runner.exe. Note the use of "console" there. It may be that opens up a "console" (like an output window) when it runs to display your program's output, and that might automatically go away when your program ends, I don't know.

                            EDIT I think I now understand your IDE is Code::Blocks (not CodeRunner). I have done some brief Googling, which you may want to do, for CodeBlocks stdout. There are indeed various hits about "how do I get to see the output from my program from CodeBlocks".

                            If we take, say, https://stackoverflow.com/questions/28878911/how-can-i-get-console-output-in-code-block-ide, the guy there has a similar program to yours. One thing we are told is

                            Click on build->run or hit Ctrl+F10 and a new CMD Window should pop up, showing you your "Hello world!".

                            So that tells us it does indeed need to open a separate command/output window to send the output to. Does your screenreader tell you this window gets opened or read its content?

                            Then the last response there says:

                            Please include getchar() in the function before return statement. This happens because the computer is executing your program and doesn't wait for you to see the output. Including getchar(), at the end mandates it to wait for an input & in the meanwhile you can observe your output

                            I did wonder if this might be the case. Because your program outputs some lines and then simply terminates, it may well be that this console output window pops up when you run your program, shows the lines, and then immediately exits. So you/your screenreader may know nothing about it. You need to cause the program to "pause" before it exists so you can examine this output window.

                            I'm not a C++ expert, but I believe you should try inserting the following two lines after all your std::cout lines and immediately before your return 0; line:

                            std::string input;
                            std::getline(std::cin, input);
                            

                            If you do that, when you run your program I believe/hope it will not immediately run to exit as it does now. You will have to "find" that new output window and click the Enter key in it before it exits and then your program completes. Hopefully you can then get your screenreader to read it out before you press the key?

                            Here's a screenshot of what my project looks like now.
                            0_1564177921376_fab80b48-d5dd-4d3a-b0f7-08a520e8af57-image.png
                            And here's a screenshot of the code.
                            0_1564177954379_79727094-32ac-4da2-a426-6e8d36889568-image.png

                            aha_1980A Offline
                            aha_1980A Offline
                            aha_1980
                            Lifetime Qt Champion
                            wrote on last edited by
                            #322

                            @annabelle yeah, it seems to work somehow.

                            The output screen shows Hello World!.

                            The only strang thing is: according to your code there should have been more lines of output (all the lines you added after hello world).

                            Are you sure the latest code is compiled and you are not running an older version of your program?

                            Qt has to stay free or it will die.

                            A 1 Reply Last reply
                            1
                            • aha_1980A aha_1980

                              @annabelle yeah, it seems to work somehow.

                              The output screen shows Hello World!.

                              The only strang thing is: according to your code there should have been more lines of output (all the lines you added after hello world).

                              Are you sure the latest code is compiled and you are not running an older version of your program?

                              A Offline
                              A Offline
                              Annabelle
                              wrote on last edited by
                              #323

                              @aha_1980 said in Qt Programming Language:

                              @annabelle yeah, it seems to work somehow.

                              The output screen shows Hello World!.

                              The only strange thing is: according to your code there should have been more lines of output (all the lines you added after hello world).

                              Are you sure the latest code is compiled and you are not running an older version of your program?

                              This time I am running the newest version of the code, and here's what I get.
                              0_1564319940533_fccd4ff9-c4b5-43ca-8a5d-d77139ca77f1-image.png
                              0_1564320044318_fccf42fa-8cc7-444e-afe0-84f37c7bd057-image.png

                              JKSHJ 1 Reply Last reply
                              0
                              • A Annabelle

                                @aha_1980 said in Qt Programming Language:

                                @annabelle yeah, it seems to work somehow.

                                The output screen shows Hello World!.

                                The only strange thing is: according to your code there should have been more lines of output (all the lines you added after hello world).

                                Are you sure the latest code is compiled and you are not running an older version of your program?

                                This time I am running the newest version of the code, and here's what I get.
                                0_1564319940533_fccd4ff9-c4b5-43ca-8a5d-d77139ca77f1-image.png
                                0_1564320044318_fccf42fa-8cc7-444e-afe0-84f37c7bd057-image.png

                                JKSHJ Online
                                JKSHJ Online
                                JKSH
                                Moderators
                                wrote on last edited by JKSH
                                #324

                                @annabelle said in Qt Programming Language:

                                This time I am running the newest version of the code

                                Unfortunately, your latest code contains an error so it cannot be compiled. This means you are still running the old version. As a result, your output screen only contains "Hello world!" and nothing else.

                                Does your screenreader report the error details to you? You should have heard, "error: expected initializer before 'std'". Did you hear that?

                                Anyway, the error message is telling you that something is missing before 'std' on line 11. In your case, you are missing the open curly braces { after main(). Punctuation is very important in C++ code, so you must pay careful attention to them.

                                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                A 1 Reply Last reply
                                1
                                • JKSHJ JKSH

                                  @annabelle said in Qt Programming Language:

                                  This time I am running the newest version of the code

                                  Unfortunately, your latest code contains an error so it cannot be compiled. This means you are still running the old version. As a result, your output screen only contains "Hello world!" and nothing else.

                                  Does your screenreader report the error details to you? You should have heard, "error: expected initializer before 'std'". Did you hear that?

                                  Anyway, the error message is telling you that something is missing before 'std' on line 11. In your case, you are missing the open curly braces { after main(). Punctuation is very important in C++ code, so you must pay careful attention to them.

                                  A Offline
                                  A Offline
                                  Annabelle
                                  wrote on last edited by
                                  #325

                                  @jksh said in Qt Programming Language:

                                  @annabelle said in Qt Programming Language:

                                  This time I am running the newest version of the code

                                  Unfortunately, your latest code contains an error so it cannot be compiled. This means you are still running the old version. As a result, your output screen only contains "Hello world!" and nothing else.

                                  Does your screenreader report the error details to you? You should have heard, "error: expected initializer before 'std'". Did you hear that?

                                  Anyway, the error message is telling you that something is missing before 'std' on line 11. In your case, you are missing the open curly braces { after main(). Punctuation is very important in C++ code, so you must pay careful attention to them.

                                  My screenreader didn't tell me that particular error. Should I create a separate line with just an { on it?

                                  aha_1980A 1 Reply Last reply
                                  0
                                  • A Annabelle

                                    @jksh said in Qt Programming Language:

                                    @annabelle said in Qt Programming Language:

                                    This time I am running the newest version of the code

                                    Unfortunately, your latest code contains an error so it cannot be compiled. This means you are still running the old version. As a result, your output screen only contains "Hello world!" and nothing else.

                                    Does your screenreader report the error details to you? You should have heard, "error: expected initializer before 'std'". Did you hear that?

                                    Anyway, the error message is telling you that something is missing before 'std' on line 11. In your case, you are missing the open curly braces { after main(). Punctuation is very important in C++ code, so you must pay careful attention to them.

                                    My screenreader didn't tell me that particular error. Should I create a separate line with just an { on it?

                                    aha_1980A Offline
                                    aha_1980A Offline
                                    aha_1980
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #326

                                    @annabelle yes, please add { on a new line directly after the line with main.

                                    Qt has to stay free or it will die.

                                    A 1 Reply Last reply
                                    0
                                    • aha_1980A aha_1980

                                      @annabelle yes, please add { on a new line directly after the line with main.

                                      A Offline
                                      A Offline
                                      Annabelle
                                      wrote on last edited by
                                      #327

                                      @aha_1980 said in Qt Programming Language:

                                      @annabelle yes, please add { on a new line directly after the line with main.

                                      Here's a screenshot of a new version.
                                      0_1564349705120_92e06ec3-7ee3-44f7-8297-8c26d2c7491c-image.png
                                      Here's where I'm confused. There's an error message in a few places that says, "cout in namespace std does not name a type.". What does this mean? Also, it seems that when I just put an { on a blank line, Codeblocks automatically puts a line below with a couple spaces, followed by a line with a single }. What's up with that, I wonder?

                                      JKSHJ 1 Reply Last reply
                                      0
                                      • A Annabelle

                                        @aha_1980 said in Qt Programming Language:

                                        @annabelle yes, please add { on a new line directly after the line with main.

                                        Here's a screenshot of a new version.
                                        0_1564349705120_92e06ec3-7ee3-44f7-8297-8c26d2c7491c-image.png
                                        Here's where I'm confused. There's an error message in a few places that says, "cout in namespace std does not name a type.". What does this mean? Also, it seems that when I just put an { on a blank line, Codeblocks automatically puts a line below with a couple spaces, followed by a line with a single }. What's up with that, I wonder?

                                        JKSHJ Online
                                        JKSHJ Online
                                        JKSH
                                        Moderators
                                        wrote on last edited by
                                        #328

                                        @annabelle said in Qt Programming Language:

                                        when I just put an { on a blank line, Codeblocks automatically puts a line below with a couple spaces, followed by a line with a single }. What's up with that, I wonder?

                                        Code::Blocks was trying to be helpful. Often, when people type {, they also want a corresponding }. The "couple of spaces" marks the location where people normally type in their code. (The code goes between { and }).

                                        However, you already had the closing } on your last line, so Code::Blocks ended up introducing another error. You must always check the characters that are automatically typed by your IDE. If it is not appropriate, you must remove it.

                                        Here's where I'm confused. There's an error message in a few places that says, "cout in namespace std does not name a type.". What does this mean?

                                        This error was caused when a } was inserted into your code. std::cout is not a type, so it can only be used inside a function body, between { and }. You will learn more about types and functions as you work through the learncpp.com tutorial.

                                        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                        A 1 Reply Last reply
                                        2
                                        • JKSHJ JKSH

                                          @annabelle said in Qt Programming Language:

                                          when I just put an { on a blank line, Codeblocks automatically puts a line below with a couple spaces, followed by a line with a single }. What's up with that, I wonder?

                                          Code::Blocks was trying to be helpful. Often, when people type {, they also want a corresponding }. The "couple of spaces" marks the location where people normally type in their code. (The code goes between { and }).

                                          However, you already had the closing } on your last line, so Code::Blocks ended up introducing another error. You must always check the characters that are automatically typed by your IDE. If it is not appropriate, you must remove it.

                                          Here's where I'm confused. There's an error message in a few places that says, "cout in namespace std does not name a type.". What does this mean?

                                          This error was caused when a } was inserted into your code. std::cout is not a type, so it can only be used inside a function body, between { and }. You will learn more about types and functions as you work through the learncpp.com tutorial.

                                          A Offline
                                          A Offline
                                          Annabelle
                                          wrote on last edited by Annabelle
                                          #329

                                          @jksh said in Qt Programming Language:

                                          @annabelle said in Qt Programming Language:

                                          when I just put an { on a blank line, Codeblocks automatically puts a line below with a couple spaces, followed by a line with a single }. What's up with that, I wonder?

                                          Code::Blocks was trying to be helpful. Often, when people type {, they also want a corresponding }. The "couple of spaces" marks the location where people normally type in their code. (The code goes between { and }).

                                          However, you already had the closing } on your last line, so Code::Blocks ended up introducing another error. You must always check the characters that are automatically typed by your IDE. If it is not appropriate, you must remove it.

                                          Here's where I'm confused. There's an error message in a few places that says, "cout in namespace std does not name a type.". What does this mean?

                                          This error was caused when a } was inserted into your code. std::cout is not a type, so it can only be used inside a function body, between { and }. You will learn more about types and functions as you work through the learncpp.com tutorial.

                                          Now I'm getting an error that says, "Expected Unqualified ID before Return"
                                          And another that says, "Expected Declaration before }". What am I doing wrong? It seems I'm following the tutorial closely, but I'm stuck.

                                          JKSHJ JonBJ 2 Replies Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved