Starting from:
$30

$24

Week 1 Hello World Solution

Overview




This hands-on lab demonstrate a simple sequential print statements using an online C compiler such as ideone.com. You should follow the instructions to complete the lab as well as perform the learning exercises at the end of this lab.




Instructions




Open up any online C compiler (e.g repl.it or ideone.com).



Be sure the C Language is selected.



Enter the code below into the editor. (Note: LEO doesn’t let you just copy and paste from this document so you can either download the document and then copy and paste or just go to the Code for HelloWorld link for this week and copy and paste from there.)



Click the submit, or run button.



Try the additional learning exercises on the next page.



Here is what the “Hello, World” looks like using repl.it after a successful run. You will need to set up a free account in this IDE, and select a project language, in this case C, which will create the basic “Hello World” project for you.



















Run the program




























Input/Output Panel




Source Code Panel

















































1

Here is what “Hello, World!” Looks like using ideone.com after it has successfully run



























































































Hello, World C code




#include <stdio.h




int main(void) {




printf("Hello: World?");

return 0;

}




Learning Exercises for you to complete




Demonstrate you successfully followed the steps in this lab by preparing screen captures of you running the lab as specified in the Instructions above.



Remove the semi-colon (;) at the end of this statement: printf("Hello: World?");



Describe what happens. Why is the semi-colon needed?




What happens if you add another printf statement such as:



printf(".. Bye ..");




after the printf("Hello: World?"); line?




Describe the new output. Be sure to support your description with screen captures of executing the new code.




2




Experiment by adding additional printf statements to your code such as: printf(".. Bye .. \n");



printf("Hello & again! \n");




What does the "\n" do to the output?




Be sure to experiment by adding several printf statements and describe the resulting output. Be sure to support your description and experimentation with screen captures of executing the new code.




(Optional) For more fun, try some of the following experiments:



Add some comments using the // token. Everything after that token on a line is ignored.



Try commenting out (adding a // at the start of a line) line 1. What happens? UNDO this change before trying any other experiments!



What happens if line 5 is commented out?



Try the /* ... */ style commenting.



Add a header block of comments using the following syntax:



File: myFile.cpp



Date: month day, year



Author: my name



Purpose: get the IDE working



Try the following header comment block format:



/* File: myFile.cpp *Date: month day, year * Author: my name




* Purpose: get the IDE working */




Add a printf statement telling the user who wrote this program – something like the



following:




printf (“Hello world written by Jane Doe\n”);




Experiment with the \n token. Some ideas: move it around, split up the \ and the n, use more than one, leave off the \.



















































3

Submission




Submit a neatly organized word (or PDF) document that demonstrates you successfully executed the Hello,World on your machine using an online compiler. You should provide a screen capture of the resulting output.




Also, provide the answers, associated screen captures, C Code and descriptions of your successful completion of learning exercises 1, 2, 3, and 4.




The answers to the learning exercises, screen captures, C code and descriptions can be included in the same neatly organized document you prepared as you ran the Hello, World application. Note the code can be embedded in the word document. However; be sure all code compiles and runs perfectly before submitting the document.




Submit your document no later than the due date listed in the syllabus or calendar.




Grading guidelines




Submission
Points
Demonstrates the successful execution of this Lab within an
30
online compiler. Provides supporting screen captures.


Accurately describes the function of “; “and what happens if
20
the semi-colon is removed from a line of C code.


Accurately describes the addition of a printf statement to the
20
C code. Provides supporting screen captures of additional


printf statement.


Experiment by adding additional printf statements.
20
Accurately describes the functionality of “\n”. Provides


supporting screen captures for additional functionality.


Document is well-organized, and contains minimal spelling
10
and grammatical errors.


Total
100








































































4

More products