1,171 Posted Topics
Re: >so please help me by giving me the correct code We'll never give you free code on this forum, did you read the forum rules? Let me guess...NO!! :) Some information about linked lists: [LIST] [*][URL="http://www.inversereality.org/tutorials/c++/linkedlists.html"]http://www.inversereality.org/tutorials/c++/linkedlists.html[/URL] [*][URL="http://richardbowles.tripod.com/cpp/linklist/linklist.htm"]http://richardbowles.tripod.com/cpp/linklist/linklist.htm[/URL] [*][URL="http://www.cprogramming.com/tutorial/lesson15.html"]http://www.cprogramming.com/tutorial/lesson15.html[/URL] [*][URL="http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx"]http://www.eternallyconfuzzled.com/tuts/datastructures/jsw_tut_linklist.aspx[/URL] [/LIST] | |
Re: [QUOTE=BlackStar;861174] Is there a way for the user to say, I want to go to restaurant queue 3?[/QUOTE] Yes, create an array of restaurants and access each 'restaurant' via it's subscript :) | |
Re: So you've posted your code and what now? What is your question? | |
Re: What you mean is dynamic memory allocation, check out [URL="http://www.cplusplus.com/doc/tutorial/dynamic/"]this[/URL] first and feel free to ask questions if you don't understand something :) | |
Re: Is "Press ENTER to continue" also good? [CODE] cout << "Press ENTER to continue ..." << endl; cin.get(); [/CODE] | |
Re: [QUOTE=ulisse0;862149]What? I have no idea what you are talking about.[/QUOTE] He's talking about the C++ [ICODE]fstream[/ICODE] class(es) Edit:: Sorry I misunderstood the OP's post (he was actually quoting but I didn't notice that) :( | |
Re: Did you try the [URL="http://gmplib.org/manual/"]online manual[/URL] available on it's site? | |
Re: Why didn't you put the end braces? [CODE]int _tmain(int argc, _TCHAR* argv[]) { cout << "Welcome to Airline Manager v1.0" << endl << endl; FlightManager fMan; [COLOR="Red"][B][COLOR="Green"]}[/COLOR][/B][/COLOR] [/CODE] [CODE] class FlightManager { public : FlightManager(); [COLOR="Red"][B][COLOR="Green"]}[/COLOR][/B][/COLOR] [/CODE] | |
Re: When a class has one or more pure virtual methods, the class is called an abstract class, but you cannot just create an object from it, you first have to derive a class from your abstract class and then you've to override the pure virtual methods before you can use … | |
Re: ->First: Please post using code tags! ->Second: You have to know how to write manipulators :) | |
![]() | Re: Actually you should check the input on being a valid integer or not :) To check whether the input is an integer or not, you could do something like this (you'll have to pass the input as a string): [CODE=C++] bool checkInt(const string &s) { int len = s.length(); for(int … |
Re: [CODE][B][COLOR="Red"]ifstream[/COLOR][/B] file; file.open( file_name.c_str(), ios::[COLOR="Red"][B]out[/B][/COLOR][B][COLOR="Red"],[/COLOR][/B] ios::binary );[/CODE] shouldn't that be: [CODE][B][COLOR="Green"]ifstream[/COLOR][/B] file; file.open( file_name.c_str(), ios::[COLOR="Green"][B]in[/B][/COLOR] [B][COLOR="Green"]|[/COLOR][/B] ios::binary );[/CODE] | |
Re: Want an example of a bubble sort? Check out [URL="http://www.daniweb.com/code/snippet1177.html"]this[/URL] :) | |
Re: [QUOTE=NathanOliver;860733]...and was wondering if this would work.[/QUOTE] Just compile and run it, and if there are problems: post them (and in case of an unexpected result please tell also what output you did expect) :) | |
Re: Dev-C++ starts getting dated, use the newest MinGW-compiler(s) instead ... Edit:: Actually there comes a document with the distribution which describes the whole process ... Edit:: Look at [URL="http://wiki.allegro.cc/index.php?title=Code::Blocks"]this[/URL] link (STEP 1) to find more information on how to install the MinGW-compiler | |
Re: > Just want to remove all the spaces from a string? >> Use a function like this one: [CODE=C++] string trim(const string &s) { string t; for(unsigned int i=0; i<s.length(); i++) if(s[i] != ' ') t+= s[i]; return t; } [/CODE] >> Just put your read expression into a string … | |
Re: Put [CODE] cout<<endl<<"Wrong option number!! Try again\n"; cin.get(); //give the user a chance to read the output data [/CODE] in a [ICODE]do-while[/ICODE]-loop and change [ICODE]cin.get();[/ICODE] to [ICODE]cin>>option;[/ICODE] like this: [CODE] do { cout<<endl<<"Wrong option number!! Try again\n"; cin>>option; } while(option<1 || option>2); [/CODE] | |
Re: You could change your get_char function to: [ICODE]char get_char(int n) {return n-'0';}[/ICODE] (edit:: unless your goal is to also provide conversions from other bases) In your rev-function (see line 72) a for-statement would be better to use I think, it will also compact your code a bit :) (You can … | |
Re: Could you please post your code (using code tags!!) and paste the [U]exact[/U] error message(s) you're getting? | |
Re: Check out [URL="http://www.cplusplus.com/reference/string/string/find/"]this[/URL] :) | |
Re: Avoid the use of [ICODE]system("pause");[/ICODE] ([URL="http://www.gidnetwork.com/b-61.html"]reason[/URL]) Use [ICODE]cin.get();[/ICODE] instead :) ... | |
Re: [ICODE]while (count=0);[/ICODE] has to be [ICODE]while (count==0);[/ICODE] If you write [ICODE]while (count=0);[/ICODE] then variable count gets assigned value 0, so this means the assignment will return zero which is equal to false with the result the while loop won't run :) ... | |
Re: [QUOTE=soppyhankins;859268]Hello again all!!! I just have two quick questions... 1.) Is it possible for one to run a program through the "system(command)" and have the output come out on top of an SDL program? Like if I had a background of some sort and typed "system(echo "Hello!")" could I have … | |
Re: [QUOTE=mightykyle;860193]plz help[/QUOTE] Don't be impatient, if you want fast help you should give a detailed and understandable description of what your problem is first :) | |
Re: We're not making this homework assignment for you, show us what you've already done so far ... | |
Re: [QUOTE=Frank Wallis;857009]Did you run scandisk command on your computer?[/QUOTE] In Windows XP it isn't called scandisk but [ICODE]chkdsk[/ICODE] :) ... | |
Re: >Can you help me with what I am doing wrong? Sure, what's your problem? (be specific!) Are you getting unexpected output? | |
Re: Why are you using a [ICODE].C[/ICODE] file-extension for [ICODE]SingletonMain[/ICODE] and why a [ICODE].cpp[/ICODE] file-extension for the file [ICODE]Singleton[/ICODE] ??? I would just use [ICODE].cpp[/ICODE] for both file's extensions, as it's the most common :) ... | |
Re: Your code is just overkill ! I know a better one (this one has no errors :P): [URL="http://www.daniweb.com/code/snippet898.html"]http://www.daniweb.com/code/snippet898.html[/URL] :) ... | |
Re: Another remark: avoid the use of [ICODE]system("pause");[/ICODE] (See [URL="http://www.gidnetwork.com/b-61.html"]http://www.gidnetwork.com/b-61.html[/URL]) You could use [ICODE]cin.get();[/ICODE] instead of [ICODE]system("pause");[/ICODE] :) | |
Re: The first question you should ask yourself is: is it worth all the work to built in all those code to create a demo version? What's your application about, what does it do? You should also think about the following problem: If the trial/demo period has ended, the user could … | |
Re: > You just copied your homework assignment and pasted it into this thread, so what's your question ? slore>If the number passed to the function is negative, the function will return the negative of the square root of the positive number. >>>>>> Actually that's not true math :P > Please … | |
Re: > I also need advice on converting a C++ Octal or Hexadecimal Notationed string to an integer. To do conversions between numbers and strings, [stringstreams](http://www.java2s.com/Tutorial/Cpp/0240__File-Stream/Usestringstreamtoparseanumber.htm) are often used :) Lines 28-50 can be replaced by: `return a-'0';` | |
Re: Avoid using system("cls") (look [URL="http://www.gidnetwork.com/b-61.html"]here[/URL] for why, the reasons are the same) :) | |
Re: According to [URL="http://www.nokia.co.uk/find-products/all-phones/nokia-5800/specifications"]this[/URL] specifications it isn't ... | |
Re: A bad_alloc exception is thrown when dynamic memory allocation has failed, I think this is often the case when your system has not enough memory, or are you allocating to much memory ? A memory leak could be, but me eyesight is not good enough to see your program's source … | |
Re: If you're using XP Home it might be probable that there's an administrator account without a password (called 'Administrator') Normally the password of this account is blank and you can access it by starting your computer into safe mode (press F8 just before the Windows Loading screen shows up), if … | |
Re: [QUOTE=Lexter25;858344]Thanks it works!![/QUOTE] > From the comments skydiploma got on his post I read the following: "Find the bug. - Dave Sinkula" >> Now to the OP: Welcome to the world of C++: it isn't because it seems to work that it actually works :) | |
Re: > Ask specific questions about what you don't understand, all what you've done is just copied and pasted your assignment in this thread :) ... > If you want help, do some effort first, give it a try, and when you get stuck you can always ask questions ... | |
Re: >For some reason the [code=c++] tag isnt working(OFFTOPIC) Did you type the word 'code' in uppercase ? | |
Re: > The [URL="http://www.talula.demon.co.uk/allegro/"]Allegro[/URL] Game Programming Library is definitely the way you should go ! agentx> hope u people will help me in getting those bonus marks! >> We'd like to help you with this stuff but remember that we aren't doing the coding for you, you'll have to do that … | |
Re: Dear rahul, your code won't compile: [ICODE]student std[x];[/ICODE] is never going to work :P (edit:: unless x is a constant expression) Thats just what the OP was asking for: Dynamic Memory allocation, your code doesn't explain dynamic memory allocation I think ... Edit:: Take a look at [URL="http://www.cplusplus.com/doc/tutorial/dynamic/"]this[/URL] to get … | |
Re: > I'm writing exactly the same code, but probably a bit easier to understand: >> Original posted code: [CODE] int sum=0, a=0, b=0; for (a=1;a<3;a++) for (b=1;b<5;b++) sum+=b; cout <<"sum =" <<sum; [/CODE] >> The above code is actually pretty much the same as this :): [CODE=C++] int sum=0, a=0, … | |
Re: > First calculate the whole number where you want to take the square root from (calculate the sum of the first n elements of the series) >> Formula for the first series: (1/9)+(1/25)+(1/49)+... => [ICODE]1/((3+(n-1)*2)^2)[/ICODE] (n represents the nth element of the series :) ...) >> Formula for the second … | |
Re: > Have you already read [URL="http://msdn.microsoft.com/en-us/library/7xcz0y39(VS.71).aspx"]this[/URL] ? | |
Re: I think I've seen that book before, you don't have to take it seriously :) ... | |
Re: I find it great you want to share your knowledge, but for me it wasn't very helpful because of the two following reasons: -> I did already know this -> I don't use Windows Vista | |
Re: [QUOTE=christiangirl;858240]But I don't know why it is being set to [/QUOTE] > Did you actually write this code yourself? > If yes, you could try using a debugger > BTW, Avoid the use of [ICODE]system("PAUSE");[/ICODE] (look at [URL="http://www.gidnetwork.com/b-61.html"]this[/URL] excellent information written by WaltP :)) | |
Re: Instead of [ICODE]cin>>name[/ICODE] you could use [ICODE]getline(cin, name);[/ICODE] to get the first name and the surname :) ... | |
Re: > Take a look at [URL="http://www.cprogramming.com/quiz/"]this[/URL] > Try [URL="http://lmgtfy.com/?q=c%2B%2B+quiz"]this[/URL] one also :P |
The End.