I've been trying to learn it also, but studying alone makes me get bored of it easily. Anyone interested in learning C++ in a group? it'll be so CACHE (lol, get it?)!
I just decided to start using C. but now I has a question.
I was reading through this tutorial and saw:
#include <stdio.h>
int main()
{
int a;
a = 0;
while (a <= 100)
{
printf("%4d degrees F = %4d degrees C\n",
a, (a - 32) * 5 / 9);
a = a + 10;
}
return 0;
}
The code above is supposed to make a Fahrenheit -> Celsius table (0-100 F). My question is... what does that 4 before the "4" mean? I changed it and compiled it (to %5d) and all it did was make the table go from
0 degrees F = -17 degrees C
10 degrees F = -12 degrees C
20 degrees F = -6 degrees C
30 degrees F = -1 degrees C
40 degrees F = 4 degrees C
50 degrees F = 10 degrees C
60 degrees F = 15 degrees C
70 degrees F = 21 degrees C
80 degrees F = 26 degrees C
90 degrees F = 32 degrees C
100 degrees F = 37 degrees C
to
0 degrees F = -17 degrees C
10 degrees F = -12 degrees C
20 degrees F = -6 degrees C
30 degrees F = -1 degrees C
40 degrees F = 4 degrees C
50 degrees F = 10 degrees C
60 degrees F = 15 degrees C
70 degrees F = 21 degrees C
80 degrees F = 26 degrees C
90 degrees F = 32 degrees C
100 degrees F = 37 degrees C
basically, it just made the table messy. Can anyone tell me the real meaning of that?
Name:
Anonymous2008-06-08 15:49
It's the number of characters that you reserve for the field (field width). Also, how could you manage not to find this on google? All you have to do is google "printf" and you have the whole damn command reference... lr2google, it's very important because whatever you code there's always going to be a function/api/library reference that you need to look up.
>>130
Realtime app driving a fairly powerful laser. Garbage collection could interrupt the program at unpredictable times, which would be a nasty thing when the laser is scanning live tissue.
By default variables that store objects point to the value of the object when it should be referencing it.
Templates are just half ass macros.
And there is nothing wrong with Garbage Collection when done right. A Decent garbage collector works automatically be default, but allows full control if you need it. The .Net CG works this way.
For retards like you (by "you" I mean the overwhelming majority of this thread) the language is only as powerful as GUI toolkits and database intefaces that allow you (see above the definition of "you") to make trivial programs that no one cares about.
Exactly. You should use x86 assembly instead. FrozenVoid! will help you to achieve your goal.
Name:
FrozenSperm!FrOzENLOAU2009-01-08 11:44
>>149
Actually, the CPU rewrites C++ code as x86 assembly, so it isn't that bad. However it is a waste of processor power to write in a higher level langauge if it's only going to be converted to x86.
This is why languages like Javascript are so nice - they don't go through that translation layer, so they can be more efficient.
Name:
FrozenSperm!FrOzENLOAU2009-01-08 11:49
>>151
No it isn't, the CPU has to do that. Unless you're compiling it by hand on paper - in which case, why would you write in C++?
Name:
Anonymous2009-01-08 12:03
Mr. Babbage is not pleased with all this tomfoolery.
Name:
Anonymous2009-01-08 12:13
>>155
"On two occasions I have been asked, – "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" In one case a member of the Upper, and in the other a member of the Lower House put this question. I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.[35]" http://en.wikipedia.org/wiki/Charles_Babbage
Name:
Anonymous2009-01-08 12:20
>>157
It's not automated, you have to write the checks yourself.
Name:
Anonymous2009-01-08 12:43
>>159
"Automation plays an increasingly important role in the global economy and in daily experience. Engineers strive to combine automated devices with mathematical and organizational tools to create complex systems for a rapidly expanding range of applications and human activities."
ttp://en.wikipedia.org/wiki/Automated