Computing desk | ||
---|---|---|
< November 19 | << Oct | November | Dec >> | November 21 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
Where do I write my code for C ++? Do I have to download some sort of software, or can I just do it in Notepad or something? Jamesino 02:15, 20 November 2006 (UTC)
Dev C++ is good if you want an IDE, vim and gcc are better if you're just learning basics. --frothT C 18:06, 21 November 2006 (UTC)
I'm actually curious about this too: So you program, by typing all of those abbreviated commands, "if-then"s, etc. I get that. But then, isnt THAT what the computer decodes to execute whatever you wanted? clearly not...so what does a compiler do, transfer all this into 1's and 0's? I looked on the compiler page, nothing helpful about the practical side of it. 140.180.136.121 02:33, 25 November 2006 (UTC)
Here's what I hope is a gentle introduction...
You can type and save (hence, create) C code (or any other programming language I know of) using any text editor. It is best that it is a plain text editor. The differences between text editors is great, and goes far beyond an introductory discussion. I am careful not to say too much: this is the stuff of flame wars.
When saving a c source code file (what you typed), make sure it ends with a .c, e.g., "some_code.c". This may trick you in MS Windows if "Hide Common File Extensions" is turned on. I'm not at a Win machine right now, but it's a preference you can set without too much trouble. (If you do any development or are curious about the actual files on your computer, turn that off. It just complicates things, as it hides information about the files.)
You can then run your code (which, despite it ".c" ending, is still plain text, just like an HTML, XML, or any other "source code" file) through a compiler, which (assuming there are no compile-time errors) will generate executable files in machine code, the proverbial 0s and 1s, which are actually tiny switches that turn the circuits on and off in your computer. Your computer doesn't understand your source code.
(So why does a computer "run" code from interpretted languages like Ruby, Perl, Python or PHP, but not C? They, too, are "compiled", but this is typically done by their respective interpretters as they are being ran, so the scripter/user doesn't notice. However, for compiled languages like C/C++, you actually compile the code into an executable file, which is stored then ran. That file will only work on computers like yours: same processor and operating system. Different hardware and operating systems will interpret the 0s and 1s differently, which makes porting a faithful version of Internet Explorer to SuSe Linux difficult.)
So, for example, say you are on a Unix machine. I open up an editor I like called Vim. You can open up any text editor... Anyhow, save this code in a file called hello.c:
main(){ puts("Hello Kitty!"); return(0); }
Then, using the famous GNU compiler called GCC, type in the shell prompt "gcc code.c" (assuming you are on a Unix machine and are in the directory with the code.c file). It will output a file called "a.out". To run it (in Unix), type "./a.out". (The "./" means "in this directory, execute the following file:")
The principles carry over to other editors, compilers and operating systems. The are all independent: theoretically (without getting too technical), text editors produce the same thing, and theoretically (we could only wish) all compilers coule handle all standard C code by producing identical binary code.
This, of course, is full of generalities, and to make things worse, I'm not much of a c programmer, though I am a programmer. Cheers, good luck, and use whatever makes you comfortable until you are ready to try new tools.
Bryan
BTW, same principles apply to C++. Any compiler that works with C++ automatically works with C, since C is a subset of C++ (and is the predecessor of C++, as the name would imply).
Note
If you want to code in C++, you should save your files with a .cpp extension. The C++ code for the Hello world program is:
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World!";
return 0;
}
LestatdeLioncourt talk 17:17, 26 November 2006 (UTC)
People prefer larger and larger PC screens and moreover, these days, they prefer wide screens. This definitely is ok for watching movies and checking mail. But is it good for people who use the PC only for reading news? Wont there be eye pain if we sit straight and move our eyes wide? Or I assume even if we turn our necks and read, there will be eye pain. Or am I wrong - ie. you may say 'we don't have eye pain reading for hours using large wide screens; May be you check a doctor'. Which is right? Don't you have problems reading with large wide screens?
Anyway, if you were to choose a laptop only for reading, which size would you prefer? And should it be wide screen?
Here's a question. Is there a utility that will allow you to "maximise" your windows to a 4:3 or any other user-defined aspect ratio with one button click (instead of maximising to the full screen size)? This would leave e.g. the right-hand edge of the screen free on widescreen monitors. Zunaid©Please rate me at Editor Review! 07:27, 21 November 2006 (UTC)
Hi, wondered if you guys could offer some thoughts on the following... I have just built my first PC. ordered all the bits off the web, put it together, turned it on - bingo. I put the WinXP cd in and it starts to format the hard drive. so far so good. at 66% complete, I figure it's safe to leave the room for a little while. I don't know what stage the install had got to but suddenly all the light go off in the house - something's tripped the main fusebox.
I narrow the problem down to the new PC. bit by bit I unplug things like the h/d, cdrom, floppy and eventually even the motherboard and it still trips the fusebox. Even with the psu completely unplugged from everything, as soon as I introduce the lead to the psu it trips the fusebox. The lead has a 5amp fuse in it and is borrowed from a working computer. the psu is 400w.
do you think it's a faulty psu? it was a cheap one from the web - the manufacturer is listed as 'various'. I've since tried the lead on another pc and that works fine.
what are the chances that my other components are ok? my fusebox is very sensitive and will trip when a lightbulb blows.
all suggestions/info/advice gratefully received.
16:00, 20 November 2006 (UTC)~
The PSU is not necessaryily faulty -given that the fuse trips when a lightbulb blows your psu could trip it too. Some power supplies take a lot more power when you turn them on than when they are running - and require a soft start with relays gradually switching on the power. Question - is there an on/off switch on the psu - if you plug the psu into the mains with the switch on it will bypass any protective circuits built into the psu. To repeat:Though your psu may be faulty if the fuse trips when a bulb blows it's almost certainly going to go when you switch that thing on. consider getting one with a soft-start or bypassing the fusebox on switch on - it should be ok to switch the tripper back in when you've got it going..
I strongly advise that you DO NOT BYPASS THE MAINS TRIP SWITCHES while switching on your computer. While it could be a live to neutral short circuit causing your overload switch to trip, I'd expect such a PS unit problem to be smellable and audible. From what you describe, I'd bet heavily on the PSU causing your residual-current device on your main switchboard to trip. Possibly some isolation (air gap or plastic) inside the PSU broke down during the first run, and you now are dealing with an established chronic current leakage. I do not see how your peripherals, running on 5-12V DC, could be tripping your mains switchboard all the way backwards through the PSU. Whatever it turns out to be, you are describing a PSU failure, and the safest advice is to get a new or properly working one. As a separate issue, it sounds as if the mains circuit breaker is not quite what it should be any more - it seems overtly grouchy:) Seejyb 22:05, 20 November 2006 (UTC)
thanks for the suggestions and help everyone.
I searched for a free FTP client since I know there are a few around. The top Google result was SmartFTP and the snippet that google gives you from the website says that SmartFTP is free (it's not free and a 30-trial doesn't qualify as free in my book). I check the source code and found this. [crowd gasps and someone can be heard puking]
<meta name="description" content="Welcome to the home of SmartFTP, the free secure FTP client for Windows.">
Are they deliberately misleading us? Are they misleading Google also, or are they in on it? --Username132 (talk) 22:42, 20 November 2006 (UTC)
I have heard of click trackers and how spyware, malware, etc. can read a computer's site visits, also to enable parents to see where on the Internet their children have been. I am looking for a free program that I can use on my own computer to eliminate past clickage; is there something available? 23:07, 20 November 2006 (UTC)
What computing language (C++, Java, Visual Basics, etc...) are applications such as Adobe Photoshop and modern top-tier games (such as World of Warcraft) coded with? Jamesino 23:17, 20 November 2006 (UTC)
I ran across this piece advice in Wikipedia itself: RTFM. I thought you might find it amusing, if nothing else. The Transhumanist 00:51, 21 November 2006 (UTC)
Is there a way to see if there is a Wiki-effect on Google similar to something being Slashdotted? By that I mean, is there a way to see if people searching for the Colbert video went up after the article about it appeared on the main page? Dismas|(talk) 08:17, 21 November 2006 (UTC)
I'm typing a LaTeX document including some article numbers, which in turn contains hyphens. I don't want line breaks within these, but unfortunately, they break. How can I stop this from happening? 62.119.184.141 10:02, 21 November 2006 (UTC)
\nolinebreak
, but for several hyphens that would become rather tedious. --Tardis 15:29, 21 November 2006 (UTC)At the moment, if you enter the word "fuckwit" into Google and hit "I'm feeling lucky", you get taken to the official UK government's webpage on the Deputy Prime Minister, John Prescott. I think this is pretty funny, but someone has obviously has engineered it. How? --Richardrj talk email 10:11, 21 November 2006 (UTC)
Imagine you are given a choice to choose a cell phone and if all of these mobiles cost the same, which one do you choose? 1) 2.5 inch blackberry type screen 2) 3 inch blackberry type screen 3) 3.5 PDA type screen 4) 4 inch screen 5) 5 inch screen 6) 6 inch screen 7) 7 inch ultra mobile type screen. Note here that, if you are a mobile person, you may want a small screen fitting to your mobility needs. But if you dont mind carrying 7 inch screens around the world, no problem! Also tell me why you have chosen your choice. Generelly, tell me what do you think people would do if given a choice apart from the choice of yours!