99 Posted Topics
Re: [QUOTE=Mr Bin;874379][B]Please help me how to do it. Thanks![/B] A 5-star hotel has 3 room types below: - Room type A, Price 80 USD / day. - Room type B, Price 60 USD / day. - Room type C, Price 40 USD / day. Room rental is calculated by formula: … | |
Re: [CODE=cplusplus] while (getline(iofile,line)) { cout << line << endl; } [/CODE] Your code is on the right track. Check out the [ICODE]getline[/ICODE] function's prototypes here: [URL="http://www.cplusplus.com/reference/iostream/istream/getline/"]getline - C++ Reference[/URL]. The file structure you have described is known as a "Space-delimited File". In your [ICODE]getline[/ICODE] function, specify the [ICODE]delim[/ICODE] parameter. (If … | |
Re: [QUOTE=szcfama;875310]the problem is ... i need the reading loop to halt when data runs out but honestly I'm new to C++ and unsure how too...[/QUOTE] See this post for more details: [URL="http://www.daniweb.com/forums/post875397.html#post875397"]http://www.daniweb.com/forums/post875397.html#post875397[/URL] | |
Re: Like monkey_king said, we have to know the structure of your file to help you with this. For example, Your [ICODE]Horses[/ICODE] structure: [CODE=cplusplus]typedef struct { char hname[20]; char rname[20]; char IDNum[20]; char race [20]; float time; } Horses;[/CODE] Sample File Structure (in [ICODE]HorsesFile.txt[/ICODE]): [CODE] My Horse,My R Name,My Horse ID,My … | |
Re: [QUOTE=timb89;874948]any ideas anyone?[/QUOTE] [URL="http://www.dreamincode.net/forums/showtopic10157.htm"]Here[/URL] is a good tutorial on linked lists amongst other C++ data structures. Have a look at their implementation of a singly linked list, and try to [B]emulate[/B] it (Emulation helps you remember [I]how[/I] to do things rather than blindly doing it)... Hope this helped! | |
Re: [QUOTE=karjan;874395]how i can convert string to int in c++ gui mode[/QUOTE] Please, refrain from hijacking threads. It would just confuse anyone having the same difficulty as the OP, and would make our jobs of attempting to answer [B]to the [COLOR="Green"]original question[/COLOR][/B] difficult. If you have a question, like the one … | |
Re: [QUOTE=SallyJ;873302]Can someone please explain what \n\n means in a line of text in C++? For example ("\n\nWelcome to Main Menu\n\n"); Thanks[/QUOTE] A [ICODE]\n[/ICODE] character is a special type of character(new line character), termed as an escape sequence. It serves the same purpose as [ICODE]endl[/ICODE], which is to move the console … | |
Re: Maybe you should try a simpler algorithm, like this one: [CODE=cplusplus] int i = 0, j = 0; // Counters string Buffer; // Acts as a buffer containing characters while(getline(FileIn, Buffer, ' ')) { cout << "M[" << i << "][" << j << "] = " << Buffer << … | |
Re: [QUOTE=dirnthelord;872242] I tries this code for the third pattern...I have no Idea how to get them done....can anyone post codes for all of them? [/QUOTE] This statement, to me, sounds like you are trying to get us to do your homework for you. You [B]must[/B] show some measure of good … | |
Re: What are you trying to accomplish with the above code? You seem to have misunderstood the uses of arrays, and its definitely not needed in this implementation... Apart from that, your code just doesn't make sense... I would strongly recommend you take this tutorial of the C++ language, its uses … | |
Re: > C++ won't allow this. Why? Well, if you have touched upon the subject of templates in C++, then you must know that C++ templates are **type-specific**. This means that once you have declared a pointer(well frankly, *any* instantiation) to a templated class, using a certain `<class>` or `<typename>`, you … | |
Re: [QUOTE=arenq;872814]Can you tell me which basic operations on a list can cause an use of stack proportional to the size of the list? (I mean, looping on all elements...) I have problems with stack size. Is iterator post-incrementing dangerous in this sense?[/QUOTE] Could you make your question clearer? Which Stack … | |
Re: How about: [CODE=cplusplus]// A function to convert Long to String string longToString(long In) { ostringstream OutStream; OutStream << In; return (OutStream.str()); } /* ... */ /* This function traverses your array of Long Integers (MyLongArray), and converts each long integer into the corresponding string values and stores them in the … | |
Re: This does have to do with a slope, but of a different sort. When you mean - moving an object in a 2D vector, what do you mean? Do you mean the STL's [ICODE]std::vector[/ICODE]? or mathematical vectors? | |
Re: Could you at least post your current code for doing whatever it is that you are trying to accomplish? | |
Re: Yes, I tend to agree with Narue. I would take a pot-shot and ask for you to check the closing statement of your [ICODE]Graph[/ICODE] class, and make sure that it terminates with a [ICODE]};[/ICODE] | |
Re: Okay, I haven't fully understood your first question, but I'll try and clear up parts of it that I have understood. Just tell us what you want to do in context of the following, or, if this isn't it, could you explain what it is that you want to do … | |
Re: [QUOTE=tizzo233;870949]sorry i don't understand. you mean i should set head= new node;//i already did. doesn't that set it?[/QUOTE] I'm sorry, but I have to agree with ArkM - there's a ton of mistakes in the provided code. Just go through it, step by step and straighten out the code. You … | |
Re: Which compiler/IDE are you using? [ICODE]<conio.h>[/ICODE] is a non-standard header file. Besides this discrepancy, there seems to be no need for it in your code... If you had compiled this on a new compiler, then this would surely have thrown an error, wouldn't it? | |
Re: Which IDE are you using? Some IDE's like Dev C++ have the choice of adding your own Application Icon even to Console Projects. Code::blocks has this facility, but you will have to create a separate resource file defining the Icon as a part of your project. But then again, this … | |
Re: [QUOTE=Salem;870943]You need one of two things a) [URL="http://www.imdb.com/title/tt0088763/"]A DeLorean[/URL] b) [URL="http://www.thefreecountry.com/compilers/cpp.shtml"]A Compiler which actually matches your OS[/URL] The second option is usually better, as appropriate specs for option 1 are hard to come by, what with the world's energy crisis.[/QUOTE] Lol! :D ... yes, i think the second option is … | |
Re: [QUOTE=Usura;870967]anyone know why this wont work? [CODE] fstream f; f.open("a.dat", ios::in | ios::out | ios::binary); [/CODE] it doesnt create a.dat... also how would i switch f from read state to write state?[/QUOTE] Of course this code wouldn't create [ICODE]a.dat[/ICODE]. You are asking it to [B]open[/B] the file, not create it … | |
Re: Hi! Firstly, if you're a beginner, then its better if you model your game as a text-based game. Game Programming using graphics, audio etc can quickly become overly complicated if you have little or no previous experience in C++ (trust me on this). You would have to worry about a … | |
Re: Maybe you should try this: Make the following Window Handles Global: HWND hWndPrincipal; HWND hWndPrincipal2; HWND hWndPrincipal3; HWND hWndPrincipal4; I'm not sure if this will work, but I made a program that is similar to what you are trying to do, and making my handles global resources sorted out many … | |
Hi! [U] [B] Virus Details ; Platform: Win XP[/B][/U] My laptop is affected by some sort of virus, and as it destroyed my AVG 8.5 free installation, I downloaded Avira Free antivirus software. This virus didn't let me install it (It blocked out all antivirus websites) and keeps downloading small … | |
My friend got a virus on his computer some time ago. Its called MSRun32.exe, and it is absolutely wreaking havoc on his computer. Really, if it were any slower, time would be going backwards for it. I got rid of the virus, but I hadn't realized at the time that … | |
Re: Hi, In answer to question 2, you can run a full scan from AVG (which version?), and simply move it to the vault, which is just as effective as getting rid of it from the system as it disables it. Some of the viruses will not 'heal' as it can't … | |
I've made a program that generates a Character's details(Game details, like level, name, HP, etc, based on a few parameters). I've added another .cpp file to it [without a main() function], but when I try to compile the whole project in Dev-Cpp, it just shows an error. My code is: … | |
Re: [CODE=cpp] #include <iostream> #include <string> using namespace std; void change(), clue(), menu(), compare(); char n1[8], n2[8], n, password[20]; int main(){ do{ char name[20]; system ("cls"); cout<<"Menu:\n"; cout<<"1. Clue:\n"; cout<<"2. Change password?\n"; cout<<"3. Exit\n"; cout<<" Enter your choice:\n"; cin>>n; system ("cls"); switch (n){ case '1': char clue1[20]; clue(); break; case '2': … | |
This is my resource file for a program: [CODE=cplusplus] #include "resource.h" // IDR_MYMENU MENU BEGIN POPUP "&File" //<=error is here BEGIN MENUITEM "&Refresh", ID_PROG_REFRESH MENUITEM "E&xit", ID_FILE_EXIT END POPUP "&Edit" BEGIN MENUITEM "&Options", ID_PROG_OPTIONS END POPUP "&About" BEGIN MENUITEM "A&bout AC", ID_PROG_ABOUT END END [/CODE] I've Checked the above over … | |
Here's a funny program that simulates the matrix...waaay off topic... [CODE] #include <iostream> #include <ctime> using namespace std; const int NotUsed=system("color 02"); int main() { clock(); int n; double time; char matrixwords[]=" aijk FGHIJKlmnopqrs ABCDtuvELMNO PQRS bcde fghTUVWXYwxyzZ"; char matrix[]="01001100100101011110"; clock(); for(int o=1; o<=70; o++) { cout << "/"; } … | |
hey, This might be naive, but how come this bit of code isn't working??? [CODE] int lc=0; read.open(filename_user.c_str(), ios::in); while(getline(read, linecount, '\n')) { ++lc; }[/CODE] Have looked through the internet, and this code seems to be fine, so what is it that makes it not work?? the output is always … | |
Hello, Now, this may sound stupid, as it concerns basic file I/O, but my code doesn't work correctly- at least it isn't doing what I want it to. I wanted it to write a file the first time it runs, which it does perfectly, and every time it is run … | |
Re: Have you tried 'enable cookies' options? | |
Re: Hi, Have you tried pinging for websites? If not, try this... 1. From the desktop, click start 2. Select Run 3. In the Run box, type command 4. Click OK 5. The DOS window will pop up. At the C:\WINDOWS> prompt type ping [url]www.domainname.com[/url] and press enter. 6. You will … | |
Re: [QUOTE]O20 - Winlogon Notify: jkkkjig - jkkkjig.dll (file missing) O20 - Winlogon Notify: jxngzkqo - jxngzkqo.dll (file missing) O20 - Winlogon Notify: nnlmkjk - nnlmkjk.dll (file missing)[/QUOTE] These are the virus/malware infecting your system, but I think you cleaned these off. Select these entries and "check fixed". The symptoms seem … | |
Re: Hi, This seems to be a new virus that seems to be affecting loads of people! Does this virus alert lead you to an *anti-virus software* marketing website? This seems to be one in a series of worldwide virus attacks of this sort, me being one of them, but of … | |
Re: Hi, There could be a couple of reasons as to why your computer is running slow. It could be because you have loads of programs or processes using up all your memory(not the CPU usage) or it could be that there is a virus in your computer(again, did this happen … | |
Re: Hi, First of all, could you post a Hijack This log as this will reveal all the processes linked to the problem. Make sure that you close all other instances of any program before you run it. Again, did you run a full system scan with a good, trusted anti-virus … | |
Re: Hi, [QUOTE]Is it normal be receiving upwards of 11 million bytes and sending 2 million? [/QUOTE] Yes, it is normal to have 10.5 MB received and sending 1.9 MB when you surf the internet. This could be because you may have downloaded something, been to loads of websites, or have … | |
Re: hi, Nothing seems to be that much out of the ordinary in your Hijack This log file. Did you try a full system scan on AVG? | |
Re: [QUOTE]O21 - SSODL: dwnrpofk - {B66919AF-4DD7-4E67-A20D-C69F0153FC49} - (no file)[/QUOTE] This indicates that you have had a malware attack recently as dwnrpofk.dll is a harmful component to have in your system. It seems to have been deleted or removed its reference from the registry(?). Everything else seems to be ok. As … | |
Re: [QUOTE]O21 - SSODL: axrfgvek - {3AA1CF0B-64D6-4250-A16A-6B39D719FB95} - C:\WINDOWS\axrfgvek.dll O21 - SSODL: okmdepgb - {7A2046A5-4F19-4F1B-8709-686B7F246392} - C:\WINDOWS\okmdepgb.dll[/QUOTE] These two entries ought not to be there. These are confirmed class *B* threats and are known to cause computer dysfunction. As to the Regedit problem, you can do this: Start -> Run -> … | |
Hi everyone, I am Amrith, 16, and am really glad I joined Dani web. It has helped it a lot before(before I was a member and occasionally strayed here). I find this site is resource-rich and fun to browse through. I mainly do web designing and have already done three … | |
Re: Hi, Have you tried to uninstall it and then reinstall it again? Sometimes, it could be a faulty installation that could cause a problem (I installed a program without the required pre-requisites and it failed to open). Again, i am no expert, but this has helped a couple of times … | |
Re: Yeah, it happened to me as well, but I just removed it and everything is well again! This used to happen with some of the older updates as well, but microsoft sent along some patch to fix this later on, so I wouldn't worry about getting this patch right now. … | |
Re: I agree with iamthwee. There seems no point in that segment of code! It checks a relation: if a is equal to zero or not, if a is less than b, otherwise it relates b to 0, which is pointless. Is the code meant to say, check a==(some integer) and … | |
I am experimenting with a piece of code I found on the internet (I'm still relatively new to c++), but my visual c++ express edition and visual c++ 2005 ide's are not compiling it giving some errors I can't understand fully. this is the code [code=cplusplus]/**************************************************** * File: BasicCalculator.h * … | |
Re: How about this book- it covers all the basics you will need to know- [B]Ivor Horton's beginning Visual C++ 2005[/B], which starts from the basics to windows programming(both MFC and Win32 API's) You needn't have to have an extensive knowledge of c or c++ to use this book as this … |
The End.