Thread: HELP me please, New to C programming.

  1. #1
    Registered User
    Join Date
    Jan 2015
    Posts
    1

    Unhappy HELP me please, New to C programming.

    Hi,
    This is my first assignment in my C programming course and I feel completely lost, the only thing I know is that a semicolon ends a line of text.
    The assignment is to debug what the professor gave us, he also gave us a program that shows what it should do.
    There are errors that prevent compiling and errors that cause the program to run incorrectly.
    What i'm working on : Gyazo - 5b88d914f5e14a02a9c826ebd7ba3699.png
    What it should do: Gyazo - 04b396e6b945c612232a3c3d144cfd56.png
    Any help is greatly apreciated!

  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Please post the code in [code][/code] tags, and make sure it's properly formatted and indented. Also, please post the sample of what it should look like (code tags may be good here too)

    Our homework policy prevents me from giving you any answers, but hopefully the following will help you get started. Give it your best effort, and post what you think the errors are, and we'll help you sort it all out.

    Regarding only knowing about semicolons:
    1. You have been taught more than semicolon ends a line of text*. You need to review your notes, texbook, and any other materials.
    2. You have not been taught everything you need yet. Sometimes school/homework/tests are not simply about regurgitating what you have already been taught, but how you figure out what you need to know to solve a problem.

    It helps to know about the different kinds of errors you can encounter. These aren't for C, but the concepts are the same.
    Alice Programming Tutorial, by Richard G Baldwin
    Types of error

    Also, you should know how printf and scanf work, so you can recognize if/where they are being used incorrectly.
    https://www.google.com/search?q=c+printf+scanf+tutorial

    * Technically, that is not very accurate, a semicolon ends a statement. C can hvae lines of text not ending in a semicolon.

  3. #3
    Registered User Alpo's Avatar
    Join Date
    Apr 2014
    Posts
    877
    A big hint: A % symbol (followed by a letter) in a printf() statement specifies a type for the value of a variable you are wanting to print to the console. There should never be more variables than there are format specifiers ( %d, %c, %s, ect). A scanf() function is similar in that the number of variables being read into must equal the format specifiers.
    WndProc = (2[b] || !(2[b])) ? SufferNobly : TakeArms;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 09-11-2012, 01:03 AM
  2. Replies: 4
    Last Post: 12-11-2011, 04:25 PM
  3. small programming job VCPP / Object Oriented Programming
    By calgonite in forum Projects and Job Recruitment
    Replies: 10
    Last Post: 01-04-2006, 11:48 PM
  4. Total newb to programming here... Question about the many programming languages. Ty!
    By tsubotakid1 in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 10-05-2003, 10:32 AM

Tags for this Thread