• Content count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About WebNinja

  • Rank
    Will I break 10 posts?

Profile Information

  • Gender
  • Interests
  • Location
    Under your bed
  1. I understand what you are doing with your codes now heisenbug,it's pretty cool how i can pretty much figure out the code in perl and the logic behind it even without really bothering about the perl syntaxes.The recursions are pretty interesting seeing as how google shows how it can be used in multiple situations other then fibonacci number sequences.Thanks for your help =) WebNinja
  2. i dont know how to code in perl, but from what i've googled on the syntax you used heisenbug, i think i somewhat understand what you are trying to do with your code though i have a few questions. QN1.From what i can make of your subroutine(function?), it pretty much does the same thing as my fibonacci function in the code i posted.However i see that you do not include a break in your for loop, but instead use ($i<$n) where 'i' is the counter and 'n' being the value the user inputs.By doing so, won't your loop output (n-1)counts of fibonacci numbers instead of fibonacci numbers up to the nth value?(which is entered by the user). E.g(Assuming n=10) your loop will output '0,1,1,2,3,5,8,13,21,34' while my loop will output'0,1,1,2,3,5,8', which is what is requested by the challenge? QN2.By automatically output i did not mean hardcoding the first 2 fibonacci values(0,1) but by somehow including them into the code in the for loop so that then i run the program,it will simply calculate and output all fibonacci values including the first 2 values(0,1) instead of starting at the 3rd value (which is also 1) as i did.I tried googling fibonacci number sequences in c++ but the only code sample that i could find that seems to output the whole fibonacci sequence was a code that made use of recursion which i have not learnt yet,so i was wondering if there was a way to code the program to automatically output the whole fibonacci number sequence without using recursions. PS:i dont understand what &fibonacci($n) does though google tells me that $n=shift; does something with arrays.I apologize if my questions were somehow answered by these 2 lines of code. WebNinja
  3. Hey guys,i've been looking for beginner programming challenges on the internet and i came across the fibonacci number sequence challenge so i decided to give it a shot.I'm apparently not allowed to upload the c++ source file so i've copy and pasted it below. /*Generates the fibonacci sequence up to the nth number which the user inputs*/ //fibonacci sequence is 0,1,1,2,3,5,8,13,21,..., #include <iostream> using namespace std; int Fibonacci(int &number) { int counter; int firstnumber=0; int secondnumber=1; int total=0; int quit; cout<<"The fibonacci number sequence is : "<<endl; cout<<firstnumber<<" ";//entering it manually cout<<secondnumber<<" ";//entering it manually for(counter=0;total<number;counter++) { quit=total+firstnumber+secondnumber; total=firstnumber + secondnumber; cout<<total<<" "; firstnumber=secondnumber; secondnumber=total; if(quit>=number) { break; } } } int main() { int input; cout<<"Enter a number"<<endl; cin>>input; cout<<endl; if(input==0) { cout<<"Please enter a number greater than 0"<<endl; } else if(input==1) { cout<<"Please enter a number greater than 1"<<endl; } else { Fibonacci(input); } system("PAUSE"); return EXIT_SUCCESS; } so the challenge is to create a program which generates fibonacci series till a number 'n' where 'n' is entered by the user. For eg. if the user enters 10 then the output would be: 1 1 2 3 5 8. The challenge was listed as beginner difficulty but i still took nearly an hour to write the program, and only after a quick peek at the internet.Can anyone give me pointers on how to further improve my code, and how to automatically output the first 0 and 1 in the number sequence instead of manually instructing the program to output it? http://talkbinary.com/programming/c/special-functions/fibonacci-in-c/ (This is the site i referred to for help) Thanks WebNinja
  4. I've already came across that tutorial when i was googling makefiles before posting on binrev but got lost halfway through the tutorial when they started talking about macros,macros modifiers and inference rules haha.I think i'll be skipping makefiles for now and revisit them later when i am more confident in my coding skills and have more knowledge about computers and programming in general though that would probably be quite some time as i still have some 600 odd pages left to go before i finish my c++ for dummies book , which coupled with my schooling commitments only give me an hour or two for coding daily lulz.Thanks for actually taking the time to look up a tutorial for me though purplejesus, i really apreciate it.
  5. Thanks for your input thus far PurpleJesus, i have a few more questions about programming. 1.When and where do i have to use null characters in a program?I understand that null characters are used to terminate a string in c/c++, yet i have also read that everything contained in double quotes has an implicit null character included in it.If so, what is the point of the null character as it can be easily replaced by double quotes? 2.MakeFiles.Can i have a crash course or simplified explanation of makefiles if it isn't too much trouble? My c++ book introduces makefiles but only touches on it briefly while introducing lots of wierd looking code.I've read that the make utility automatically builds executable programs and libraries from source code by reading make files, which specify how to derive the target program.However, IDEs and language specific compiler features can also be used to manage the build process in modern systems, with the make utility only being widely used in unix and/or unix-like systems.If so, as i am currently on a windows 7 OS,is there any need for me to touch on makefiles?Also, why does my IDE create a makefile when i was trying out some codes? PS:I am currently using dev c++ as my IDE, trying out creating multiple source files with the use of headers and global variables, using the C++ for dummies book.
  6. Thanks for answering my noobish queries in a clear and concise manner PurpleJesus.The learning curve of C++ is steeper than i had originally thought as the logic and the usage of operators in conjunction with syntax does sometimes confuse me,as well as the placement or the semi colons having a huge impact on the way end result of the program, ie. if(i==5) v.s if(i==5); .I would like to ask how long have you been coding, seeing as you are experienced in programming, and how long did it take you to be fairly proficient enough to write your own simple program? This would pretty serve as a marker as to my progress thus far, and a measure of how far more i have to go to reach a certain proficiency in C++. WebNinja
  7. Thanks for your explanation on the hello world program, it really helped out a lot, though im now having problems again with loops =X #include <iostream> using namespace std; int main() { int i=0; bool done=false; while(!done) { cout<<i<<endl; i++; if(i==10) done=true; } cout<<"All Finished!"<<endl; system("pause"); return 0; } QN:While i do not have problems with a simple while loop using conditions such as while(i<=10), do etc etc, the logic behind the code above eludes me.While i get that [while(!done)] translates in english to "while not done, do the following...", what does it actually mean? 1:While not done(that is to say [bool done = false]), run the code till i=10 at which point, the value of done would be changed to true, hence terminating the loop. OR 2:While not done(that is to say "done" is not equals to false(i.e done = true), as the value of done was set as false above,)run the code till i=10, at which point the loop will terminate. I think the correct answer is the first option, as the second option makes no sense to me, seeing as how the value of "done" is changed to "true" once "i==10", why does the loop not execute when i set "while(done=false)".I've also tried setting the variable done as a integer rather than a boolean variable yet i cant seem to get the loop to work when i set the loop as "while(done=false)".Am i mistaken in assuming that "while(done=false)" is the same as "while(!done)" when they are in fact different? Or am i committing an error which i am not aware of ? Sorry to trouble you yet again WebNinja
  8. Thanks for replying 5imp7y, I've downloaded the compiler and used the Tut that you've linked me to start on my hello world program though i have some questions about it. Qn1.the tutorial that you've linked me to uses the line (using namespace std;),yet when i checked up namespaces on google, i came across some people saying that using (using namespace std;) in a program is a bad programming habit and is inadvisable to do so and that i should be writing (using std::cout;) in my program instead.I understand that this is so that there will not be any errors caused if i am using 2 different libraries with the word cout included in both of them in a single program i am writing.However, isn't the std library pretty much universal and contains everything thats pretty much needed for programming in C++? If so, what is the point of writing (using std::cout;) in my program if i am unlikely to use any other library then the std library in C++ seeing as it contains pretty much everythign i need?Also, assuming that i am using a personal,customised library for coding, why would i be doing so instead of using the std library? Qn2.What is the difference between void main () and int main()?I get an error when i write void main() but don't when i use int main() although they are both the same as i write return 0; in when i am using int main() Qn3. I can't view the output "hello world" as it just flashes up in a command prompt/windows wordpad looking windows before dissappearing 0.5 second later.Is there any way to make the output screen not dissappear immediately so that i can take a good look at it? xD Compiler: Default compiler Executing g++.exe... g++.exe "C:\Dev-Cpp\Beginniner projects\starter 1.cpp" -o "C:\Dev-Cpp\Beginniner projects\starter 1.exe" -pg -g3 -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -lgmon -pg -g3 Execution terminated Compilation successful PS: thats the compilation log if its needed Thanks!
  9. Hi, i was googling for a hacking resource to start learning when i stumbled across binrev and i thought this was as good a place as any to start. I've been interested in computers and hacking in general for awhile now and i've always wanted to know more about it but have had problems finding a simple and intuitive guide for beginners on the internet, hence my posting here on the forums.I would like to start off simple, by maybe writing simple executable programs and slowly work my way up to game modding, ie. character models and textures etc, as well as game hacking in the likes of teams such as Skidrow and RAZOR 1911.Also of interest to me would be hacking like denial of service, brute forcing, etc. I know that most hackers are self-taught and do not like free-loaders but i would appreciate any help that i can get, or if someone would just point me in the right direction to start or the best language to starto ff with.I've heard that i should start off with languages like java or C,C++,C#(what's the difference with the 3 C languages?), as i can do many things with them.I've also taken a module in basic programming in html a few years back and learnt a little about algorithmns though i dont realy remember much of it anymore. Thanks in advance