5,676 Posted Topics
Re: First, please format your code properly so we can follow it. All loops and ifs need to be indented: [CODE]Dim q, e, g As Integer 'parr(mini) = maxi If mini <> maxi Then If nop > 0 Then For e = 0 To maxi + 1 'On Error GoTo hell … | |
Re: Since you are using a C++ string, use the string functions .find(), .substr(), .erase() With a simple GOOGLE search I found [url=http://www.cprogramming.com/tutorial/string.html]this[/url] | |
Re: [QUOTE=Greywolf333;1492642]Use peek to see what's ahead one character. This is probably the easiest way, but maybe not the most efficient.[/QUOTE] Yes, inefficient, and bad. You have to read the next character anyway, so why peek, then read? Look at line 27. Is that an assignment? | |
Re: Take it a step at a time. Create the class, output the board. When you can do that move on to the next step whatever you think that is. You add information to the class as you discover you need it. | |
![]() | Re: Yes, easiest is to open the file for read and check for an error. ![]() |
Re: See the [url=http://www.daniweb.com/forums/faq.php?faq=aup]Acceptable Use Policy[/url], section [B]Posting[/B]. | |
Re: [url=http://lmgtfy.com/?q=FIFO]Try This[/url] | |
Re: You need to use a flag to keep track of whether or not a \n has already been output. Start with the flag set to TRUE. When you output a character, set the flag to FALSE. When you want to output \n, test the flag. If the flag is FALSE, … | |
Re: [B]elf_handle[/B] is probably defined wrong. | |
Re: [QUOTE=PerplexedWon;]Problem I am experiencing: When I compile my code, I get these two error codes: 1) In file included from C:\Users\PaulWilliams\Desktop\CSci Work\C++ Programming\TestScores.cpp 2) unterminated #ifndef I am not understanding what I did wrong, [/QUOTE] [U]Unterminated[/U]: Without end; having no termination. from wordnik.com does not end, conclude, or cease. from … | |
Re: [QUOTE=BitBlt;]I did some COBOL in the 80's and 90's under DOS/VSE, MVS and VSE/ESA. Also, some MicroFocus Cobol under PC-DOS back in the day. What is your question?[/QUOTE] I'm sure after 4 months he's was just waiting for someone to ask him to post his question :icon_rolleyes: | |
Re: Also, in your editor's options set the TAB key to add 4 SPACEs instead. All those TABs make the code harder to read. | |
Re: You need to rethink these comparisons. Read them out loud and see if they sound correct: [CODE] if (200 <= salary && salary <= 299) else if (300 <= salary && salary <= 399) else if (400 <= salary && salary <= 499) else if (500 <= salary && salary … | |
Re: Because integer division truncates. [ICODE]200 * (1/2) = 0[/ICODE] because 1/2 = 0 using integers. Cast your values to floats during the equation: [ICODE](float)200 * ((float)1/(float)2) = 100[/ICODE] | |
Re: Since you didn't post any code, we have no way of knowing what you did wrong. This is a very simple task and how you tried to do it will tell us what to suggest. Otherwise you get suggestions like the one above by [B]rxlim[/B] | |
Re: [B]numberOfColumns[/B] is not a "[I]constant value[/I]" so you can't declare your array the way you did. | |
Re: Please see [url=http://www.gidnetwork.com/b-38.html]this to format your code[/url] so we can read it (it's very hard to follow as it is) and also [url=http://www.gidnetwork.com/b-66.html]this about main()[/url]. What is the value of [ICODE]sizeof names[i][j][/ICODE]? Are you sure this is what you want? It really helps to print the value of important variables … | |
Re: It isn't possible with Standard C. You have to learn special function added by the compiler authors for your specific compiler and operating system. | |
Re: [QUOTE=slygoth;1489442]I need some help with the toupper code. [code] int main() { char pick; printf("A. Local needs\n"); printf("B. Local Service\n"); scanf("%d",& pick); switch (pick) { case 'a': printf("Hello World"); case 'b': printf("Hello Nation"); } getch() return 0; } [/code] How would i implement the toupper code so i could change … | |
Re: 1) How can you have 2.4 dimes? Or 3.7 quarters? The values of the denominations only need to be integers. 2) Have you spent 6 hours sitting in front of the computer just whacking at the code hoping you get the right answer? If so, you are missing the most … | |
Re: [QUOTE=Zvjezdan23;]However, in my switch statement it does not generate random numbers like it did earlier. You'll see what I mean. [/quote] There are only 5 switch statements. And how would we see what you mean? You didn't bother to describe it. [QUOTE=Zvjezdan23;]Other than that I need help with the scoring … | |
Re: What's the value of [B]totEmpl[/B] after the headings are printed? Print it out. | |
Re: Don't make new threads for the same problem. Continue with the old thread. And you know you could just post the relevant code, not the entire thing. | |
Re: Read three lines in a row. The last read is the one you want. | |
![]() | ![]() |
Re: I don't see an "[I]an EOF controlled while loop[/I]" anywhere in the code at all. We can't help fix what's not there. Set up the WHILE loop, read from [I]inFile[/I], and when EOF is reached, exit the loop. | |
Re: No. An array is a list of values. Values can't call functions. Only code can call functions. | |
Re: [QUOTE=Labdabeta;1488335] Also although it is generally best to avoid OS specificity and keep C++ platform independant, sometimes it is more powerful to just use the system. (for example the horrible [in my opinion] language of VB is highly OS dependant on windows, yet it is an extremely powerful language that … | |
Re: [QUOTE=ejiroy;1487993]I am trying to make a program that will read in a text file and count the number of words that have a certain length from 1 to 20. So it should count the words that have a length of one, two, etc., and print it out. I have been … | |
Re: [QUOTE=Crutoy;1488399]But then im gonna lose the the sizes it might mean that larger disk can be placed on the smaller. With that logic i can't know which disk is larger all i know is it has a disk on peg. I must be stupid i just don't see it.[/QUOTE] No, … | |
![]() | Re: [QUOTE=anu07;]This is my computer science project,we were told to make any software we wish to make,so I thought about making a calculator,below is the code,but it doesn't seem to be functioning well,could anyone help and tell me what went wrong(I am using borland cpp 4.5 compiler,this program uses getch() to … ![]() |
Re: The change doesn't seem to be working correctly. QUOTING: [I]Now, when you are using the quote tags that show/hide the quote, the first line of the quote always shows up. This gives you a sneak peek to refresh your memory what the quote is, and which line of the person … | |
Re: You gave up? The process is simple. Each year has 365 days. Every year divisible by 4 (Leap Year) has 366. Every month has a set number of days (except month 2 in LY). A simple matter of addition. 1) How many years*365 2) Add in # of leap years … | |
Re: There is a difference between a character array and a string. A character array [ICODE]char a[3] = {'a', 'b', 'c'};[/ICODE] is not a string. Just because it happens to end in a '\0' when you don't define all the elements [ICODE]char a[3] = {'a', 'b'};[/ICODE] does not make it a … | |
Re: Read the line using [iCODE]getline()[/iCODE]. Find the [I]last[/I] SPACE. Everything before is the first/middle name, after is last name. | |
Re: [I]Your[/I] code is not GPL, only the software you use that is already GPL. | |
Re: Draw the the pattern on paper. Analyze the numbers you need: 1) for each given line number 2) how many leading spaces 3) how many characters 4) how many trailing spaces Look for a numerical pattern that can be programmed. | |
Re: [QUOTE=spoonlicker;]I have no idea at all, nothing, on how to make a full, running and working snake game.[/quote] Then you should probably do something you at least have an idea how to do. Do this project later when you're not so clueless. [QUOTE=spoonlicker;]... And I mean do it with out … | |
Re: Line 26: Ouput [B]account[/B], [B]string2[/B], and [B]string3[/B]. See what the values are. Also, are [B]string2[/B] and [B]string3[/B] useful names? What are they for? The answer will give you better variable names for them. | |
Re: If you go to the casino, you will never see the dealer 'pick a random card from the deck' (your technique), they 'randomize the deck' (shuffle) and deal top to bottom (use an index). | |
Re: You never put a value into [iCODE]d[/iCODE] therefore [iCODE]if ( d < 1 )[/iCODE] is comparing junk with 1. | |
Re: [QUOTE=Charu_U;]why don't you share your code, so that i can modify it to give required result.[/QUOTE] Yes, the Original Poster (OP) should share his code, but [I][B][U]you[/U][/B][/I] do not modify it to get it to work. We do not approve of cheating. [I]You[/I] can give suggestions on how to fix … | |
Re: Find a copy and put it in the [I]include[/I] directory. But if you expect it to work, the real answer is you can't. VC++6 has no graphics functionality that works with graphics.h | |
Re: Also, since this is the C forum, using C++ commands to do the work will just confuse and frustrate anyone trying your suggestions. A for effort, F for execution. | |
Re: [QUOTE=gerard4143;]Also, why all the comments its really distracting.[/QUOTE] Because good programmers comment their code so others can follow it. [QUOTE=efronefron;]sorry its an assignment from my university so I have to write all that comments. I hate it too so please bear with me :/[/QUOTE] Don't apologize. Keep it up. Comments … | |
Re: [QUOTE=richieking;]Start looking into vector ok? its more flexible and a template. This mean you can extend your code to other data types. [/QUOTE] You're kidding, right? What is the Total, Average, and Mean of a list of names? :icon_rolleyes: | |
Re: ASCII characters are just numbers. So if you wanted onthe the upper case letters for example, the are 'A' thru 'Z', or 65 thru 90. So 1) limit your random value from 0 to 25 (number of letters) 2) add 'A' or 65 to it. That will give you all … |
The End.