Match Posted February 13, 2009 Posted February 13, 2009 Hi Don't ask me why but put it down to insanity, I decided to have a go at learning a little C++ programming. :eek: so off into web world I go and find this compiler free and find me a bigginers guide and start reading now everthing was going fine, open cmd window open notepad from window to generate a .cpp file, saved .cpp file :) now my tutorial says that the command from the cmd window is >cl -GX sample.cpp this threw up an error and generally said that -GX needed replacing with EHsc so I tried >cl EHsc sample.cpp and >EHsc sample.cpp and got access denied to both. so can anyone tell me how to get the .cpp file into the compiler from a command prompt or point me in the direction of a free online tutorial that works please. Quote
Match Posted February 15, 2009 Author Posted February 15, 2009 OK I've solved this problem a couple of days ago :) Basically is down to Run as Administrator Compiler and the command window if you wanted to know!! If anyone can still help point me in a Vista based tutorial then that would be appreciated as their seems to be differences between C++ for Vista and XP which isn't surprising as its an environment dependant language (if that's the right phrase), or maybe I should just try jumping up a step to C# or Java? any advice would be gratefully received as it been 25 years since I tried programming Quote
kypeswith Posted February 23, 2009 Posted February 23, 2009 mm tell me how the version of windows would change t3h codE?? i know i tried using visual C++ on vista and my "using namespace std;" line didn't do jack! (it was in global scope, if that matters) i had to use namespace:: for everything.. Quote
Match Posted February 23, 2009 Author Posted February 23, 2009 The biggist problem that I'm having is basically down to I don't know what I'm doing :) but basically the online tutorials that I'm trying to use are xp based and I'm finding that some of the commands don't work in vista, and not being familiar with the syntax of C++ this leads to me having to search the net for clues on how to :( but from what I have learnt about C++ it is invoroment dependant which is why C# and Java developed to run on different systems, and hence be more web friendly. but there again I could have been reading a load of rubbish and got the wrong end of the stick?? but any advice is welcome and appreciated Quote
kypeswith Posted February 23, 2009 Posted February 23, 2009 I recommend bloodshed dev C++ for a free compiler, it has an IDE too! completely free! it might work on vista, i have it on an xp system sitting right next to me, and i installed xp pro 64 bit on this one a couple days ago.. mm why not get a free one with an ide is what i think :) well on the site it supports xp, doesn't say anything about vista so i would give it a try, it's a pretty good compiler Bloodshed Software - Dev-C++ <-- link and if you're beginning always remember, the variable on the Left hand side of the = sign gets assigned the value of whatever is on the right hand side, pretty simple, right? i made that mistake a long time ago.. i don't have any more advice, sorry. but, i would help you debug some code if it's simple.. Quote
Match Posted February 23, 2009 Author Posted February 23, 2009 Thanks Kypeswith, I'll give it a try as I don't really have anything to loose at the moment other than sanity :) Quote
kypeswith Posted February 23, 2009 Posted February 23, 2009 mmm just made a prime number thingy :) doesn't do much special but should serve as a good example, and i could give you t3h wrox press C++ tutorial (good one) as a .chm if you want to add me on msn messenger : kypeswith(at)hotmail(dot)com /* PRIME NUMBER... FINDER...THINGY.. started at 15:16 2/23/09 ended on 15:45 2/23/09 ..don't ask why it took so long */ #include<iostream> #include<windows.h> using namespace std; int main() { int cnt,prime,mod; cnt=2; prime=11; while(prime < 100) { if(prime%cnt== 0) { prime++; cnt=2; } if(prime%cnt !=0) { cnt++; } if(cnt>=(prime-1)) { cout << prime << endl; cnt=2; prime++; } } system("pause"); return 0; } Quote
kypeswith Posted February 23, 2009 Posted February 23, 2009 mm i need to use some elseif and else schtuff.. that and get rid of the mod integer, it isn't used at all, lol Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.