Thread: My idea.

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    25

    My idea.

    So, basically i'm new to programming especially in C. I can do web scripting, so I'm not completely new to the concept of programming.
    But right now i'm a student in a computer engineering degree. I missed out on the C programming class I was supposed to take this summer, and one of the classes i'm in now will require basic C knowledge.

    My goal is to actually become pretty proficient in programming using the C language, and what I would like to do is to get some more experienced programmers to give me ideas for simple programming that will help me learn some of the basics.

    I thought that it would also be a good thing for other newbs too. That way there are like goals for them to try to reach // meet.

    Opinions on this strategy, and anybody want to give me somewhere to start?

    Thanks in advance,
    ZS

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    266
    One idea could be to solve certain programming challenges.

    Such a site that could help you along is Sphere Online Judge (SPOJ) - Problems
    Check out my programming / algorithm blog @ http://www.swageroo.com

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    This advice is based on my own experience; take it as you will.

    The very first basics should come out of a book or tutorial. Those programs have very little practical value, except for illustrating the concepts and becoming familiar with the syntax. The first steps consist largely of reading, and the little programming snippets along the way are about supplementing those concepts, seeing them in action, and gaining familiarity with the language.

    Once you start to get a basic grasp of the language, try combining the concepts you've learned into little practice programs - again, nothing practically useful but a way to get familiar with the language. The examples given in books/tutorials are good, but you'll advance faster if you tried a few out all on your own. Simple things to start, like having the user enter numbers and printing out the sum (or difference/product).

    You hinted at something that was my biggest challenge when I first learned how to program - thinking of interesting ideas to code, for practice. Simple math functions and menu selection become boring on their own once I started to master them.

    Some ideas to consider:

    - Enter 10 numbers and find (then print) the average.
    - Enter 10 numbers and find (then print) the largest and the smallest values.
    - A simple (and very limited) calculator
    - Find the result of the multiplication of two values, without using multiplication.
    - A "cash register" program where prices are entered and totals are printed (with tax included)
    - Hangman
    - A program that takes an amount of money in "pennies" and produces the equivalent combination of dollars/quarter/dimes/nickels/pennies
    - Blackjack (simplified)
    - Hex to binary converter
    - Resistor calculator (if you're into electronics)
    - If you're into the old style RPGs (AD&D, etc), a program that rolls out stats for you
    - Replica of any simple board games you might be familiar with
    - A text-based "story" with different outcomes depending on user choices
    - Find relatively simple standard functions and try to create your own replication of it
    - A "phone book" that receives names and numbers, and stores them to a text file
    - Make your own secret code by taking a string, and go character by character in the array to change one letter to another. Then convert it back to normal.

    As you continue, the concepts become more advanced and you'll be able to do a lot more.

    There's some debate about this, but my own learning curve sharpened immensely when I started trying to code basic ASCII "games." This helped solidify my understanding of multi-dimensional arrays, pointers and pointer arithmetic, using random numbers, algorithm solving, etc. Only using ASCII characters (and the common extended ASCII set), I created my own simple version of Snake, Tetris, Minesweeper, etc. I even tried a simple RPG that didn't really go anywhere, but was still a great learning experience.

  4. #4
    Registered User
    Join Date
    Sep 2012
    Posts
    25
    Thanks for both of those answers! Matticus gave me some beginning problems to program, and the SPOJ looks like it will be nice once i've developed my skill set a little more.

    Also, I am making my way through a book required for class, but the programs they are doing have to do with formatting right now.

    One more thing, I see a lot of code on here using cout instead of printf.. Do they do the same thing? and which one would be better?

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Now why would you inquire about learning C on the C++ forum? Mistake perhaps?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Registered User
    Join Date
    Sep 2012
    Posts
    25
    Quote Originally Posted by Elysia View Post
    Now why would you inquire about learning C on the C++ forum? Mistake perhaps?
    It was actually intended for the C programming language in general, covering most variants. C, C++, C# specifically.

  7. #7
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    Quote Originally Posted by Zach Sisk View Post
    It was actually intended for the C programming language in general, covering most variants. C, C++, C# specifically.
    Well, the first step for you is to pick one, then.
    Even if the choice is a blind one, stick with it....you'll find after a few years, after you can 'code', that learning a new one is quite trivial
    (mastering each takes time though).

  8. #8
    Registered User
    Join Date
    Sep 2012
    Posts
    25
    well since the thread has already been moved, i'll stick with regular C.

    Also I found that cout must be for C++ and not C

    Also could someone briefly explain the difference between like C, ANSI C, and ISO C, or if it is anything relevant.

  9. #9
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    C is a programming language.
    ANSI C and ISO C refers to the standard that defines the C programming language.
    ANSI C is the american standard for the language standardized by some US standard body.
    ISO C is the international standard for the language standardized by the international body, ISO.
    I am not aware of any difference between the ANSI and ISO standard, though. Still, follow the international standard and everyone will be happy.

    FYI, this holds true for C++, too, though I don't know if there are any ANSI standards for C++ (there are ISO standards, however).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #10
    Registered User
    Join Date
    Sep 2012
    Posts
    25
    thanks. Right now i'm working on the practice problem of converting temperatures. And I think i'm doing pretty good for a beginner.

    Code:
    /* 
     * File:   main.c
     * Author: zachsisk
     *
     * Created on September 14, 2012, 2:51 PM
     */
    
    #include <stdio.h>
    #include <stdlib.h>
    #define UPPER 100
    #define LOWER 0
    
    
    int high = 0;
    int low = 0;
    int interval = 0;
    int temp = 0;
    
    void main(void){
        printf("Please provide a temperature (Celcius) for the upper limit.\n");
        scanf("%d", &high);
        printf("You provided %dC.\n",high);
        printf("Please provide a temperature (Celcius) for the lower limit.\n");
        scanf("%d", &low);
        printf("You provided %dC.\n", low);
        printf("Please provide an interval.\n");
        scanf("%d", &interval);
        printf("You provided %dC.\n", interval);
        temp = high;
     do {
            printf("%d", temp);
            temp = temp - interval;
           
     }while (temp != low - interval);
    
    }
    So far the problem i'm having is that if I provide say 95 and 90 with a interval of 2, I end up in a endless loop. Also I haven't implemented the high and low limits yet, but they are defined. Also haven't messed with conversions yet.

    any suggestions?

  11. #11
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #12
    Registered User
    Join Date
    Sep 2012
    Posts
    25
    Thanks for that. I really don't understand why tutorials tell you to type something that is considered bad practice and in most cases wrong altogether..

  13. #13
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Use either while(temp > low); or while(temp >= low); You can't be sure that the interval will allow the temp to be exactly reached.

  14. #14
    Registered User
    Join Date
    Sep 2012
    Posts
    25
    thanks for that advice. i'm not looking at the answer until I think I have something satisfactory. Then i'll compare and see if there are better ways to do it.

  15. #15
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    I didn't mean change the do while loop into a while only loop. I meant change the test at the bottom of the do while loop you already have there.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Any idea?
    By Moony in forum C Programming
    Replies: 9
    Last Post: 07-05-2006, 02:47 AM
  2. what's the big idea here?
    By misplaced in forum C++ Programming
    Replies: 7
    Last Post: 10-05-2004, 11:12 AM
  3. No idea at all...
    By WeZ in forum C++ Programming
    Replies: 5
    Last Post: 03-04-2004, 12:02 PM
  4. Good idea, bad idea.
    By sean in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 06-15-2002, 12:26 PM
  5. new idea....need help!
    By lonelyplanetwanderer in forum C Programming
    Replies: 5
    Last Post: 04-01-2002, 08:44 AM

Tags for this Thread