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..
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..
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..
Just a question, have you looked into the good ol' book "The C Programming Language"?
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.
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).
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 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.Originally Posted by Zach Sisk
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...
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.
Turbo C is horribly outdated: SourceForge.net: Turbo C - cpwiki.
Modern, free compilers worth looking into: Pelles C and Code::Blocks/MinGW
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.
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.
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.
So after a bit of work and refinement (the code i started with is commented out) this is what I came up with.
any suggestions on anything i could change to make it better? I'm about to go look at the solution and compare.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; */ }