![]() |
|
#1
|
|||
|
|||
New to C...need help calling functionsI'm taking an online Programming in C class, and my instructor is not very helpful. These are the assignment instructions...
Part I Write an ANSI C program that displays the "Hello, World!" message to the console. – This part is to insure your compiler is working correctly. Type in and compile the program as detailed in the lesson notes. I WANT YOU TO COMPILE FROM THE COMMAND LINE. Part II Modify your program as follows: 1. main() should call two functions ONLY. a. Create a function called myinfo or identify which will display the following information. Your name. The course name and number The Instructor’s name The assignments Number Today’s date (hint: use __DATE__ to get system date. DATE has two underscore before and after it) b. Move your logic for HelloWorld into a function called displayHello 2. main() should call myinfo first, then displayHello 3. The main() function must return a value. 4. Turn in the source code and the executable in electronic format. I have part I done, and I have myinfo done. My question is how do I get main() to call myinfo, then helloworld as well? I'm completely lost. |
|||
|
#2
|
||||
|
||||
|
Hi rbeierle. Welcome to these forums and to the wonderful world of C programming
![]() First of all, you may want to read through this thread for a little explanation of functions. Basically your entire program should be in a single file with your main() function at the bottom of the file. To define a function us: CPP / C++ / C Code:
Then in the same file to call the function, you would use: CPP / C++ / C Code:
This should get you going I hope. |
|
#3
|
|||
|
|||
|
ugh, thank you so much man. i don't know about this C stuff...it's driving me mad.
![]() |
|
#4
|
||||
|
||||
|
Quote:
Not a problem. I hope it helped. I'm a little biased but I think C is one of the greatest things you can learn for the computer. It may seem a little hard at first, but I think it really helps you to understand how a computer operates. In addition it will give you a great basis for other computer languages. If you have any struggles or problems go ahead and post them as we will try to help you out (although we won't do your homework for you Good luck! |
Recent GIDBlog
Problems with the Navy (Chiefs) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need C++ help with functions | EvilIce | C++ Forum | 2 | 01-Dec-2003 17:04 |
| need help to define a class in C++ | yannoush | C++ Forum | 7 | 09-Sep-2003 01:28 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The