Question
Could I please get some help on how to create this program? also, can I get an example of the right way to fill in
Could I please get some help on how to create this program? also, can I get an example of the right way to fill in Programmer, section, and due date? I would appreciate it.
1.Start Dev-C++.
2. To create a new C++ program, go to File/New/Source File. A blank window will open.
3. Type in the following C++ source code/program in the window, making sure to fill in the Programmer, Section, and Date Du
/*************************************************************** CSCI 240 Program 0 Spring 2022 Programmer: Section: Date Due: Purpose: Compiler training
***************************************************************/ #include#include using namespace std; int main() { cout << "hello, world"; return 0; }
Choose a meaningful file name with a .cpp extension. For example, the program above might be named hello.cpp
Notice that once you have saved the file with a .cpp extension, some of the words in your program are now in color. For example, the bold words are C++ reserved words that have special meanings. Later, you can set special colors for other kinds of items in your program (e.g. strings, comments) using Tools/Options/Edit. Doing this is optional.
Once you have the "Done in ___ seconds" message, Close the pop-up window.
4. Save the file. Use File/Save. You will see the pop-up Save File dialog window. You should select the location where you want your program to be saved. It could be your c: hard drive (on your own PC), your network drive (in the labs) or any subdirectory in any of these locations. Be sure you know where you are saving the file so you can find it tomorrow.
5. Now compile the program. Choose Execute/Compile. You will see a pop-up window and after a few seconds, the Status should read "Done in ___ seconds". If it does not, you have a compile error on the line that is highlighted. You must find and fix all such errors, and re-compile until you get the "Done in ___ seconds" message.
Once you have the "Done in ___ seconds" message, Close the pop-up window.
6. Now run the program by choosing Execute/Run. Depending on the nature of your program, you may see a prompt for user input (which you provide by typing on the keyboard) or some output displayed on the black screen (DOS window). If you typed the program listed above, you will see "hello, world".
When the last instruction in your program has executed, Dev-C++ will display the message "Process exited with return value 0. Press any key to continue...". When you do this, the DOS window will disappear.
Note: If this run step causes the error message "Couldn't create process" to show up. Choose Tools/Compiler Options. On the Compile tab, change the Compiler set to configure option to the opposite value (ie. if it's currently, 64-bit, change it to 32-bit). Re-compile the program and try to run it again.
7. Congratulations. You have created and run your first C++ program.
Sit back and relax for 15 seconds... now let's go on.
First a couple of notes on what you have just done.
When you did Execute/Compile and Run, notice that on the Execute menu there are shortcuts shown: F9 for Compile and F10 for Run. You can use these keys as shortcuts for the corresponding mouse selections. (F11 will do both steps)
When you are working in Dev-C++, you will need to keep track of several windows: we've seen the pop-up window for Compile, and the DOS window, as well as the window for Dev itself and the editing window within Dev where you type and edit your program. All of these work together and you will need to mentally keep track of which ones are open and where they are (recall, for example, that sometimes the DOS window is minimized as a button on the Task Tray). Sometimes one window may be hidden behind another. We assume that you have used Windows enough that you are familiar with the basics of manipulating the various windows. If not, see one of the 240 TA's during office hours for a brief orientation.
8. Now, just to see what will happen, let's make a couple of mistakes on purpose. Use the delete key to erase the closing " (double quote character) after the word world in your program. Now try to compile it (F9). Notice that the dialog reports several errors. This is common - one mistake may cause several error messages. Your usual response will be to try to fix the first error in your program (which is usually indicated by the first or first few messages) and re-compile. In this case, the first error mentions "missing terminating " character" and a line number (line 7 if you typed in the program as shown) which will usually indicate the location of the error.
9. Now try deleting the semicolon at the end of the same line. Compile. You see the same error messages even though we know there are now two errors. This often happens: one error "hides" another. Restore the " but leave the ; missing. Recompile. Now you see the message "error: expected ';' before 'return'".
10. Restore the ; and change the character string to: " hello, world" That's a backslash before the n. Compile and run the program. Notice there is now a blank line at the top of the DOS screen. The sequence " " makes the cursor on the DOS screen go down one line. (Try it again using a forward slash to see what will happen.)
11. Misspell the word main. Make it "maain". Compile. A Linker error should show up at the bottome of the screen. Read it. This illustrates that some error messages are not entirely clear.
12. Fix the program, compile and run it again.
13. (Almost) finally, before you leave, save the program. You will normally want to make a backup (a separate) copy of your work in case the the original is lost due to equipment failure (it could happen) or some mistake on your part (also could happen).
14. Choose File/Exit to quit your Dev session and close Dev. You can then do other work on the computer. First, though, pretend you have come back (another day maybe) to continue working your program.
15. Start Dev again. Use File/Open and locate the file you want to work on (i.e. in this case, the one you just saved in step 13 or 14). Add another line after the first cout line but before the return line:
cout << " goodbye for now..";
Compile, run, check it, save, and quit.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started