Deep Sea VI -- C Types and Functions

This forum is for the discussion of technology, computers, & problems relating to the web and your computer

Moderator: Scott Danziger

Post Reply
User avatar
Deep Sea
Posts: 1682
Joined: Sat Oct 19, 2002 6:01 am
Contact:

Deep Sea VI -- C Types and Functions

Post by Deep Sea »

Deep Sea VI -- C Types and Functions

Lecture VI is up. Only eight pages, but packed enough to significantly increase the angle of the learning curve.

The assignment for this exercise is to type-in the examples of passes 1 through 4, compile and execute, then zip-up and email your entire project.

This lecture and accompanying assignment, plus your class project, is enough to challenge most of you into next weekend.

<font color=red>Christmas</font> <font color=green>is</font> <font color=red>coming. </font>
Nothing else new until next weekend unless requested. Then, I think we should review everything learned so far and then have a closed-book test with little else new to take us into the holidays. Opinions on this are hotly requested.

------------------
Allen Moulton from Uechi-ryu Etcetera
User avatar
Deep Sea
Posts: 1682
Joined: Sat Oct 19, 2002 6:01 am
Contact:

Deep Sea VI -- C Types and Functions

Post by Deep Sea »

<font color=green><center>To test or not to test? That is the question.</center></font>

If everyone still feels comfortable, has a handle on what they've done in the lectures so far, and has their shirtsleeves rolled up waiting for the next lecture instead, I can forego the test and make the next lecture happen over the weekend.

I've covered all bases in the introductory lessons to start introducing the C language syntax. John suggested in an earlier post to focus on simple coding exercises, and that's what we're going to do.

Over the period of the next week or two, I'll introduce you to character arrays, a list of character arrays, the for loop, public and private access, and inequalities and conditionals as you build your first menu system, one step at the time.

Let me know what you think.



------------------
Allen Moulton from Uechi-ryu Etcetera
Rik
Posts: 6
Joined: Tue Dec 04, 2001 6:01 am
Location: England

Deep Sea VI -- C Types and Functions

Post by Rik »

Leaving the test for a while and continuing with the lectures sounds good to me!

Rik

[This message has been edited by Rik (edited December 14, 2001).]
Guest

Deep Sea VI -- C Types and Functions

Post by Guest »

Hi Allen, I,m kind of stalled on part 4 of lesson 6. I need to do a bit of a review to see what I'm missing. (I think I know whats wrong but not sure how to formate it)

A Relative droped by from down under that we haven't seen in many years so it may take me a day or two before I finish the last lecture. I don't think I'm ready for a test.

Laird
User avatar
Deep Sea
Posts: 1682
Joined: Sat Oct 19, 2002 6:01 am
Contact:

Deep Sea VI -- C Types and Functions

Post by Deep Sea »

I'm honing both edges of the next segments of this class as I write this post. The next lessons will be ready this weekend sometime.

Everyone is travelling at their own speeds in this course, which is not a problem as long as I can stay ahead of the fastest student (tough in karate, sometimes).

The gut feel is to hold off on the test a little longer, but not indefinitely. By Christmas I hope to have a test made up and send by email -- to be returned, completed, by email as well. It will be a closed book test, using a personal of honor system to make it so. I'm not going to grade these, rather they are a test for you to determine areas in need of additional effort. When you get them, go ahead and look them over. Crack the books open, ask questions about the questions you don't have answers for, right here on this forum.

Put the test down and out of sight for a few days without looking at it. And then go for it.
<hr>

I'm ready to attack the problem with you when you are ready, Laird.

Rik,

how are you doing? is everything clear? is there something I need to go over?

I haven't heard anything from John for awhile.

Let's get the material under our belt before we go on to the next step.



------------------
Allen Moulton from Uechi-ryu Etcetera
Guest

Deep Sea VI -- C Types and Functions

Post by Guest »

Allen, I got pass #4 to compile. When I run it I get a blank Dos screen. I zipped it up and sent it to you. Looking forward to your feedback.

Laird
User avatar
gmattson
Site Admin
Posts: 6069
Joined: Wed Sep 16, 1998 6:01 am
Location: Lake Mary, Florida
Contact:

Deep Sea VI -- C Types and Functions

Post by gmattson »

Al:
I've spent the last two days trying to recover my programs. Something (virus?) has messed up my operating system and a number of my programs.

Just getting a handle on the problem now, so I may be a bit behind in the lessons.

George
User avatar
Deep Sea
Posts: 1682
Joined: Sat Oct 19, 2002 6:01 am
Contact:

Deep Sea VI -- C Types and Functions

Post by Deep Sea »

The example on page 6 illustrates three major parts to either a program or to an independant module. For example, you will find "printString()" presented in three slightly different ways. The three major parts of this file are:

1) The part above main consists of function prototypes and include lines.

2) The calls to the functions represented by the prototypes, and

3) The function bodies at the bottom part of the file which do the work.

------------------
Allen Moulton from Uechi-ryu Etcetera

RE: In retrospect, the paragraph on page 6 which starts with the line "Next, start fleshing..." was fortified and instead began with: "Use this program as your assignment model. Type it in and compile it. Next, start fleshing..." could have done it for you.



[This message has been edited by Deep Sea (edited December 15, 2001).]
Rik
Posts: 6
Joined: Tue Dec 04, 2001 6:01 am
Location: England

Deep Sea VI -- C Types and Functions

Post by Rik »

Hi Allen,

Everything seems OK so far. I thought that the lectures were very clearly written and easy to follow. I now feel comfortable with using the IDE to create new workspaces, adding projects, compiling, building etc which I think has been the main focus so far.

I do have one question though. Could you explain when you would use 'an empty project' and 'a simple application'? When you create the latter you get an additional source file StdAfx.cpp and the header file StdAfx.h. The associated ReadMe file talks about a precompiled header. Is this some way to optimize build time for large projects?

If I am prempting the subject of a later lecture please feel free to defer answering until then.

Thanks,

Rik
User avatar
Deep Sea
Posts: 1682
Joined: Sat Oct 19, 2002 6:01 am
Contact:

Deep Sea VI -- C Types and Functions

Post by Deep Sea »

Hi Rik.

Thanks for the feedback. Without it I have no way of knowing who’s doing good and who thinks they’re hopelessly in trouble and stuck for life.

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote
Everything seems OK so far. I thought that the lectures were very clearly written and easy to follow. I now feel comfortable with using the IDE to create new workspaces, adding projects, compiling, building etc which I think has been the main focus so far.
It takes awhile to get used to the IDE and it is intimidating for awhile. In a few more months you’ll be an ole pro at it Image

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote
I do have one question though. Could you explain when you would use 'an empty project' and 'a simple application'?
It was imperative to start youse guys off with an empty project so that you’d be able to build things, especially the main function and to be able to make new files from scratch as you were getting used to the compiler.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR> When you create the latter you get an additional source file StdAfx.cpp and the header file StdAfx.h. The associated ReadMe file talks about a precompiled header. Is this some way to optimize build time for large projects?

If I am prempting the subject of a later lecture please feel free to defer answering until then. <HR></BLOCKQUOTE>This is the exact time to bring up the question because stdafx.h gets in the way. When you create your own projects for play in “sandbox,” use the simple application option. The wizard automatically creates the stdafx files and puts the #include "stdafx.h" line in your main file.

Additionally, it attaches stdafx.h and stdafx.cpp to your project. Additionally it adds “int argc” and “char* argv[]” as parameters to main. In the beginning they all get in the way.

Do the following:

1) Rewrite main to be in “main()” with no parameters. argc and argv are parameters passed into your program from the command line, and we’re haven't reached there in the course yet.

2) In terms of the stdafx guys, we’ve got to get rid of them and do some disabling in the compiler. They are used for precompiled headers which we definitely DO NOT want.

First, delete them both from the project you create, Do this by highlighting them in the workspace box on the left and hit the delete key. This removes them, two files, one in the source folder and one in the header folder, from the project.

Then, bring up a windows explorer, get into the source directory of your project and delete both files.

Close the ide and bring it up again to verify everything has been cleared out. Not necessary, but sometimes a good sanity check.

Next can be tricky, so be careful. Left-click on the project; not the workspace, folders, or files, but on the project to highlight it. Then right-click. Just below the center of the menu that appears, is a line that says “settings” and is separated into a group all by itself. Left-click on settings. The “Project Settings” dialogue box pops up. Click on the C/C++ tab near the top of the box. It’s the only thing that has C/C++ on it, so you can’t miss it (I hope). “Category:” is has a pull-down box next to it. Open it up with the arrow button. Highlight the line one-up from the bottom. That’s “Precompiled headers.” Left-click on it.

When you do that, more instructions appear in the dialogue box. Press the “not using precompiled headers radio button”. Press ok and the dialogue box goes away. If you have followed all the above steps your project will now compile using F7. I didn’t want to show this method first because I know I’d be on the borderline of tilt if I was trying to learn everything together from scratch.

The hello world option does the same as a simple project except that it adds printf, hello world, exactly what you were to do on your own in the beginning. Remove all the stdafx stuff with this one and you need to add #include stdio.h (pronounced “studio-dot-aych” to get it to compile.


------------------
Allen Moulton from Uechi-ryu Etcetera
Post Reply

Return to “Computer & Web Tech Help”