Thread: My idea.

  1. #16
    Registered User
    Join Date
    Sep 2012
    Posts
    25
    Yeah, I understood that. lol. Like I said initially, i'm not completely new to the concept of programming, just new to actually doing it.. lol. Especially in this C language..

  2. #17
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Quote Originally Posted by Zach Sisk View Post
    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..
    Because you're picking the wrong tutorials. There is a lot of crap out there on the net.

  3. #18
    Registered User
    Join Date
    Sep 2012
    Posts
    25
    Quote Originally Posted by rags_to_riches View Post
    Because you're picking the wrong tutorials. There is a lot of crap out there on the net.
    It was actually a book that told me that. It is the book that was assigned as reading for my class. My grandfather gave me his Borland C books, which do not use void. But I never checked them until now because I wanted to follow along with class. Thanks for the clarifications on that though.

    It's these kind of things that become useful..

  4. #19
    Registered User
    Join Date
    Sep 2012
    Posts
    9
    Just a question, have you looked into the good ol' book "The C Programming Language"?

  5. #20
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Quote Originally Posted by Zach Sisk View Post
    It was actually a book that told me that. It is the book that was assigned as reading for my class. My grandfather gave me his Borland C books, which do not use void. But I never checked them until now because I wanted to follow along with class. Thanks for the clarifications on that though.

    It's these kind of things that become useful..
    There's a lot of crappy books out there too. In the old days, before there was a standard for the C languages, some compilers accepted void main*. But that was a long time ago. Any decent, modern compiler should complain about you using void main, especially if you have the warnings turned all the way up. You should definitely have the warnings turned all the way up, especially as you're new to the language.

    * Some compilers still accept void main, but that is for "unhosted" environments, which is typically specialized embedded systems. You will know if you're using one of those.

  6. #21
    Registered User
    Join Date
    Sep 2012
    Posts
    25
    Quote Originally Posted by anduril462 View Post
    There's a lot of crappy books out there too. In the old days, before there was a standard for the C languages, some compilers accepted void main*. But that was a long time ago. Any decent, modern compiler should complain about you using void main, especially if you have the warnings turned all the way up. You should definitely have the warnings turned all the way up, especially as you're new to the language.

    * Some compilers still accept void main, but that is for "unhosted" environments, which is typically specialized embedded systems. You will know if you're using one of those.
    So, I'm on a mac, which complier do you recommend? Right now i'm using NetBeans, as it's the only program that will make anything. Same code on different ones and they always fail.

  7. #22
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Zach Sisk View Post
    It was actually a book that told me that. It is the book that was assigned as reading for my class. My grandfather gave me his Borland C books, which do not use void. But I never checked them until now because I wanted to follow along with class. Thanks for the clarifications on that though.

    It's these kind of things that become useful..
    There are a lot of bad books out there.
    There are a lot of misinformed people out there (like you were just a while ago).
    There are a lot of bad professors out there.

    Of course, anyone is free to write a book. So then, if someone who is misinformed writes a book, the book becomes misinformed, and everyone who reads it becomes misinformed and the whole fad spreads.
    Believe it or not, there are courses out there which teach people how to use ancient compilers and pre-ANSI/ISO C. And I mean, they are still going.
    This just adds to this crap we see all the time.

    But you are now informed of this, so my advice to you is to not blindly trust what you see or read. If something seems fishy, then double-check the information.
    When thinking of buying/loaning a book, check if it's a good book first. Here is a good site: ACCU :: Book Reviews Search
    Don't believe user reviews. Believe reviews done by professional programmers who can be trusted (yes, there are so called professional programmers out there who write crap code; this board qualifies in that respect, btw).
    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.

  8. #23
    Registered User
    Join Date
    Sep 2012
    Posts
    25
    Quote Originally Posted by WMH View Post
    Just a question, have you looked into the good ol' book "The C Programming Language"?
    No I haven't, I was reading a book for school called "C Programming For Engineering & Computer Science". Now i'm thinking that this other book from my grandfather might be better. Although it's called "Turbo C: Programming for the PC" and it seems to be pretty well off as far as everything ya'll have told me.


    Quote Originally Posted by Elysia View Post
    There are a lot of bad books out there.
    There are a lot of misinformed people out there (like you were just a while ago).
    There are a lot of bad professors out there.

    Of course, anyone is free to write a book. So then, if someone who is misinformed writes a book, the book becomes misinformed, and everyone who reads it becomes misinformed and the whole fad spreads.
    Believe it or not, there are courses out there which teach people how to use ancient compilers and pre-ANSI/ISO C. And I mean, they are still going.
    This just adds to this crap we see all the time.

    But you are now informed of this, so my advice to you is to not blindly trust what you see or read. If something seems fishy, then double-check the information.
    When thinking of buying/loaning a book, check if it's a good book first. Here is a good site: ACCU :: Book Reviews Search
    Don't believe user reviews. Believe reviews done by professional programmers who can be trusted (yes, there are so called professional programmers out there who write crap code; this board qualifies in that respect, btw).
    Like i've said, thanks for correcting me. I really prefer the self taught manner as opposed to learning it at school. But apparently finding a good book to learn from is key.

    Would it be unwise to continue my learning from this Turbo C book? What would be any major differences that I might run into?

  9. #24
    Registered User
    Join Date
    Sep 2012
    Posts
    9
    Quote Originally Posted by Zach Sisk
    Would it be unwise to continue my learning from this Turbo C book? What would be any major differences that I might run into?
    Turbo C is a C IDE for PC, as I'm sure you realize. I do believe that Turbo C has extra header files (like dos.h), but otherwise I couldn't say.

    If you want to learn pure ANSI C, Google "The C Programming Language Second Edition." Of course, the book you use is generally your preference...

  10. #25
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Zach Sisk View Post
    Like i've said, thanks for correcting me. I really prefer the self taught manner as opposed to learning it at school. But apparently finding a good book to learn from is key.

    Would it be unwise to continue my learning from this Turbo C book? What would be any major differences that I might run into?
    Yes, it would be unwise. Turbo C is an ancient compiler predating standard C: SourceForge.net: Turbo C - cpwiki
    As for books, I know not any good one for C.
    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.

  11. #26
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Quote Originally Posted by Zach Sisk View Post
    No I haven't, I was reading a book for school called "C Programming For Engineering & Computer Science". Now i'm thinking that this other book from my grandfather might be better. Although it's called "Turbo C: Programming for the PC" and it seems to be pretty well off as far as everything ya'll have told me.




    Like i've said, thanks for correcting me. I really prefer the self taught manner as opposed to learning it at school. But apparently finding a good book to learn from is key.

    Would it be unwise to continue my learning from this Turbo C book? What would be any major differences that I might run into?
    Turbo C is horribly outdated: SourceForge.net: Turbo C - cpwiki.

    Modern, free compilers worth looking into: Pelles C and Code::Blocks/MinGW

  12. #27
    Registered User
    Join Date
    Sep 2012
    Posts
    25
    I wasn't saying that I was using the Turbo C complier, haha. These are books on Turbo C that my grandpa gave me, they came with original floppies, haha.
    I am using NetBeans for mac right now. I was just asking if it would be a bad idea to read a Turbo C book? That might be what yall are saying is a bad idea. But just for clarification's sake I guess.

  13. #28
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Zach Sisk View Post
    I am using NetBeans for mac right now. I was just asking if it would be a bad idea to read a Turbo C book? That might be what yall are saying is a bad idea. But just for clarification's sake I guess.
    Yes, because such a book would C code that predates standards (ie non-standard code), plus it would not take advantage of the newer standards.
    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.

  14. #29
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Quote Originally Posted by Elysia View Post
    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.
    The first C standard was produced by an ANSI (American National Standards Institute) committee (X3J11), and ratified in 1989. It was later adopted by ISO in 1990. There was not change in content, other than the frontmatter and backmatter associated with publication. That is why you sometimes see the first C standard referred to as C89 (the ANSI date) or C90 (the ISO date). Politically, some Americans don't like to acknowledge it as an ISO standard, and some people in other countries don't like to acknowledge C as a standard that originated in America. Technically, there is no difference.

    The next standard was ratified by ISO in 1999, and adopted by ANSI in early 2000. And so it continued.

    Because, historically, the first C standard was produced by ANSI, it is still quite common for standard C to be referred to as ANSI C.

    Quote Originally Posted by Elysia View Post
    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).
    The first C++ standard (C++ 98) was produced by an ISO Committee, and adopted by ANSI. A number of (American) members of the ISO committee (or their employers) were also affiliated with ANSI.

    Since the ISO C and C++ standards (and quite a few other standards) are now automatically adopted by ANSI, it is fairly common for them to be described interchangeably as an ISO standard or as an ANSI standard.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  15. #30
    Registered User
    Join Date
    Sep 2012
    Posts
    25
    So after a bit of work and refinement (the code i started with is commented out) this is what I came up with.

    Code:
    /* 
     * File:   main.c
     * Author: zachsisk
     * Temperature Conversion Program
     * Created on September 14, 2012, 2:51 PM
     */
    
    #include <stdio.h>
    #include <stdlib.h>
    #define UPPER 200
    #define LOWER 0
    
    
    int high = 0;
    int low = 0;
    int interval = 0;
    int celc = 0;
    int far = 0;
    
    
    int main(void){
        
        
        do {
            printf("Please provide a temperature less that 200C.\n");  //Asks for a temperature for the higher temperature,
            scanf("%d", &high); 
            printf("\n");
        } while (high > UPPER);                                        //and checks to make sure it is less than 200C.
        
        do {
            printf("Please provide a temperature greater than 0C.\n");   //Asks for a temperature for the lower temperature,
            scanf("%d", &low);
            printf("\n");
           
        } while (low < LOWER);                                           //checks to make sure it is greater than 0
        
        do {
            printf("Please provide an interval.\n");                //Asks for a interval
            scanf("%d", &interval);
            printf("\n");
        } while (interval > high-low);                              //makes sure it is less than the difference of the two temperatures  
        
        printf("You have provided %dC as the upper temperature \n "
                "%dC as the lower temperature and %d as the interval. \n\n", high, low, interval);  //Tell the user what they gave.
        celc = high;                                                        //Set the celc equal to the high temperature
        printf("Celsius             Farenhieght\n");   //start a table
     do {
         far = celc*9/5 + 32;                          //Temp Conversion
            printf("%d                 %d\n", celc, far);
            celc = celc - interval;                    //Subtract the interval
             
     } while (celc >= low);                            //Repeat while Celsius is greater than or equal to low
     return 0;  
     
     //(9/5)*temp + 32
     
     
       /* printf("Please provide a temperature (Celcius) for the upper limit.\n");
        scanf("%d", &high);
        if (high > UPPER) {
            printf("Please enter a temperature less than 100C.");
            scanf("%d", &high);
        }
        printf("You provided %dC.\n",high);
        
        printf("Please provide a temperature (Celcius) for the lower limit.\n");
        scanf("%d", &low);
         if (low < LOWER){
            printf("Please enter a temperature greater than 0C.");
            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;
        */
    }
    any suggestions on anything i could change to make it better? I'm about to go look at the solution and compare.

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