Kamikaze_Badger Posted July 9, 2005 Posted July 9, 2005 To start programming again. Ever since the whole event regarding Ashbrook Prime, I've lost the will. So, any projects or challenges anyone can think of? Please keep it simple, and no OpenGL (my mind is still scarred). Share this post Link to post Share on other sites More sharing options...
martymcfly Posted July 9, 2005 Posted July 9, 2005 try to singlehandedly fulfill helpcomp2003's requests. That is a challenge. Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted July 9, 2005 Posted July 9, 2005 Lol, I said simple stuff. However, once I can get some file deleting source code... *insert much evil laughter here* EDIT: I can't even write code that compiles right... #include <iostream> #include <stdlib.h> using namespace std; int daTionOfFunc(); //Prototype int *pPointarThatPoints; int theNumbar; int main(void) { cout << "Enter a numbar!\n\n>"; cin >> theNumbar; *pPointarThatPoints = &theNumbar; daTionOfFunc(*pPointarThatPoints); return 0; } int daTionOfFunc(int one); { cout << "\n\nYou entered: " << one; cout << "\n\n\n" system("pause"); return one; } Share this post Link to post Share on other sites More sharing options...
spazmire11 Posted July 9, 2005 Posted July 9, 2005 you could make a runonceex script maker info: http://unattended.msfn.org/intermediate/me...s/runonceex.htm i still canot seem to get it quite right but im geting closer! switch detecting would be nice: http://www.msfn.org/board/index.php?showtopic=17940 just something i could use but maybe some other people would like it too? Share this post Link to post Share on other sites More sharing options...
martymcfly Posted July 9, 2005 Posted July 9, 2005 you can take me as your padawan and teach me C++ I just started it. Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted July 9, 2005 Posted July 9, 2005 Well now Young Padawan, master the art of the std namespace of the iostream header file, you shall accomplish first. Be with you, the force will. Share this post Link to post Share on other sites More sharing options...
spazmire11 Posted July 9, 2005 Posted July 9, 2005 darnit and i realy could have use a generator too! i guss i will have too pull out my vb6 book again Share this post Link to post Share on other sites More sharing options...
Blue_cow Posted July 9, 2005 Posted July 9, 2005 Um yeah you could teach me something besides basic lol. Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 9, 2005 Posted July 9, 2005 Lol, I said simple stuff. However, once I can get some file deleting source code... *insert much evil laughter here*EDIT: I can't even write code that compiles right... #include <iostream> #include <stdlib.h> using namespace std; int daTionOfFunc(int); //Prototype int *pPointarThatPoints; int theNumbar; int main(void) { cout << "Enter a numbar!\n\n>"; cin >> theNumbar; *pPointarThatPoints = &theNumbar; daTionOfFunc(*pPointarThatPoints); return 0; } int daTionOfFunc(int one); { cout << "\n\nYou entered: " << one; cout << "\n\n\n" system("pause"); return one; } 505701[/snapback] Despite it not working/compiling, again, if it makes you feel better, I could never have even written that much at your age If you want it to compile it looks to me that.. You've forgotted a ; at the end of cout << "\n\n\n" in daTionOfFunc() *pPointarThatPoints = &theNumbar; looks wrong. That would be setting the value of the pointer to the address of the number, since you've declared pPointarThatPoints as a pointer, so the * would be a... dereference. I think it should be pPointarThatPoints = &theNumbar; You have an un-needed ; in the declaration of int daTionOfFunc(int one); See, at the end there? The function prototype for daTionOfFunc() is wrong. You forgot to put the int in there. Should be int daTionOfFunc(int); Not bad though. It looks like you're getting the hang of pointers You used the pointer correctly to pass in to the function, well, you dereferenced the pointer to pass the number instead of the address at least It may be better to declare the parameter as a pointer for large data or a structure and pass the address. But for numbers, it doesn't matter too much, unless you want to change the number in that function and have it also change outside of that function Something like... #include <iostream> #include <stdlib.h> using namespace std; int daTionOfFunc(int *); //Prototype int *pPointarThatPoints; int theNumbar; int main(void) { cout << "Enter a numbar!\n\n>"; cin >> theNumbar; pPointarThatPoints = &theNumbar; cout << "main()" << endl; cout << "Number is now: " << theNumbar << endl; cout << "Pointer value is now: " << *pPointarThatPoints << endl; daTionOfFunc(pPointarThatPoints); cout << "main()" << endl; cout << "Number is now: " << theNumbar << endl; cout << "Pointer value is now: " << *pPointarThatPoints << endl; return 0; } int daTionOfFunc(int *one) { cout << "\n\nYou entered: " << *one; cout << "\n\n\n"; cout << "daTionOfFunc()" << endl; cout << "variable one = 2" << endl; *one = 2; system("pause"); return *one; } (mrboo|bone)/home/mrboo$ ./kb Enter a numbar! >1 main() Number is now: 1 Pointer value is now: 1 You entered: 1 daTionOfFunc() variable one = 2 main() Number is now: 2 Pointer value is now: 2 The difference here is that if you now change the value of "one" in daTionOfFunc(), because it's an address pointing to theNumbar in main(), the number gets changed there too. As is demonstrated by the above. Where as if you just pass the number by value, you can change it in daTionOfFunc() and it'll still be the same value in main() #include <iostream> #include <stdlib.h> using namespace std; int daTionOfFunc(int); //Prototype int *pPointarThatPoints; int theNumbar; int main(void) { cout << "Enter a numbar!\n\n>"; cin >> theNumbar; pPointarThatPoints = &theNumbar; cout << "main()" << endl; cout << "Number is now: " << theNumbar << endl; cout << "Pointer value is now: " << *pPointarThatPoints << endl; daTionOfFunc(*pPointarThatPoints); cout << "main()" << endl; cout << "Number is now: " << theNumbar << endl; cout << "Pointer value is now: " << *pPointarThatPoints << endl; return 0; } int daTionOfFunc(int one) { cout << "\n\nYou entered: " << one; cout << "\n\n\n"; cout << "daTionOfFunc()" << endl; cout << "variable one = 2" << endl; one = 2; system("pause"); return one; } (mrboo|bone)/home/mrboo$ ./kb Enter a numbar! >1 main() Number is now: 1 Pointer value is now: 1 You entered: 1 daTionOfFunc() variable one = 2 main() Number is now: 1 Pointer value is now: 1 However, I think I blabbered and you probably wont get any of that I know what you mean by needing motivation though. I do too.. I've been coding up crap in PHP + MySQL the past couple of days. That was quite fun. As for ideas of something to do. Not managed to do that encoding text thing yet? That was probably quite hard for something to start with though. Hmm... the only simple assignment I can remember from first year of Uni was a little guess the number game. Maybe you could do something like that? Make a random number, say from 1 to 10, and .. just take user guesses and say if the number was too big, too small, or correct. You might have difficulty levels like easy, medium, hard and insane... which... increase the random number range? Or.... limit the amount of guesses you have? Say 10 guesses on easy ( which means you should always win, so maybe 7 ), 5 on medium and 3 on hard and... 1 on insane? Just an idea.. Share this post Link to post Share on other sites More sharing options...
Kamikaze_Badger Posted July 9, 2005 Posted July 9, 2005 I can see it now... if (numberGuessed != theNumber) { cout << "YOU SUCK! GET THE HELL OUT!\n\n\n\n\nPlease try again: "; cin >> numberGuessed; Share this post Link to post Share on other sites More sharing options...
markiemrboo Posted July 9, 2005 Posted July 9, 2005 I can see it now... if (numberGuessed != theNumber) { cout << "YOU SUCK! GET THE HELL OUT!\n\n\n\n\nPlease try again: "; cin >> numberGuessed; 505901[/snapback] a possibility But... it's somewhere to start and it's not toooo difficult Share this post Link to post Share on other sites More sharing options...
Archerzz Posted July 10, 2005 Posted July 10, 2005 Are you programming in C++ and if so where can I get a good compiler. Share this post Link to post Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now