5,676 Posted Topics
Re: Compilers [url=http://www.codeblocks.org/downloads.shtml]Code::Blocks[/url] [url=http://msdn.microsoft.com/vstudio/express/visualc/]MSVC++ Express[/url] [url=http://www.openwatcom.org/ftp/]Open Watcom C++/Fortran[/url] [url=http://www.bloodshed.net]Bloodshed DevC[/url] [url=http://www.borland.com/downloads/download_cbuilder.html]Borland 5.5[/url] [url=http://bdn.borland.com/article/21751]Turbo 1.01[/url] [url=http://bdn.borland.com/article/20841]Turbo 2.01[/url] [url=http://148.231.149.200/aplic/tc30.zip]Turbo 3.0[/url] | |
Re: You can't possibly get 155.419 from an [I]unsigned long[/I], there is no decimal point from integers. You need [I]float[/I] or [I]double[/I]. And dividing two integers always gives an integer, even if you load it into a floating point number. For example: [code=c] double dval; dval = 25/2; [/code] 12.000 is … | |
Re: First of all, how about variables named [I]day[/I], [I]month[/I], and [I]year[/I] instead of 1 letter cryptic names. And what is [I]z[/I] for? Are you sure your date validation works? Look up the % operator to get the individual digits of each value so you can add them up. There are … | |
Re: Read [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies]the Rules[/url], especially [url=http://www.daniweb.com/techtalkforums/faq.php?faq=daniweb_policies#faq_keep_it_organized]this one[/url]. Also read the sticky at the top of the forum titled [url=http://www.daniweb.com/techtalkforums/thread78223.html][B]Read Me: [/B]Read This Before Posting[/url] | |
Re: [code] Make a loop that exits when your value is zero In the loop, calculate the modulo-10 of the value using % (get the ones digit) output the digit divide the number by 10 endloop [/code] That's basically it. | |
Re: EXTERN simply defines the variable to be accessible from a another source file. Add the EXTERN statement in a local header file and define the variable in only one of the source files. For example, in the [I]error.c[/I] source file you might define [inlinecode]int errCode = 0;[/inlinecode] In [I]error.h[/I] you … | |
Re: Seems to me you can't actually [I]solve[/I] the equation without some values. Therefore, ask your instructor for more details. | |
Re: [QUOTE=helixkod;461729]After testing the code i did come with the final result i wanted thanks to Duoas. Now my question is, how do i set it so i make an array that i do not know how big it will be since the user will input the info. in other words … | |
Re: Rule of thumb -- if you need [I]both[/I], use && (and). If you need [I]either[/I], use || (or). Test it by using English (or your native language): is it "[I]if != Q or q[/I]" or is it "[I]if != Q and q[/I]" and you get the operator to use. | |
Re: I can't see how this code does anything. You have 3 nested [INLINECODE]while[/INLINECODE] loops all exiting on the same condition. And if you [url=http://www.gidnetwork.com/b-58.html]read this[/url] you'll see your condition is wrong ([INLINECODE]feof()[/INLINECODE] is the same as [INLINECODE].eof()[/INLINECODE]) Then in the second loop, you read a single character and output it. … | |
Re: Count each number you output. After every 6th number, output a newline (\n) Use the % operator. | |
Re: Not a clue what you are asking, and your code is too hard to read. Try formatting the code using [url=http://www.gidnetwork.com/b-38.html]this info[/url] so we can follow what you're trying to do. | |
Re: The idea of this forum is to post the code here (properly please) and we [I]all[/I] get a chance to help you. Be sure to [url=http://www.daniweb.com/techtalkforums/thread78223.html]read this first[/url] | |
Re: Start by reading [url=http://www.daniweb.com/techtalkforums/thread78223.html]this[/url] and [url=http://www.daniweb.com/techtalkforums/announcement8-3.html]this[/url]. | |
Re: Please [url=http://www.gidnetwork.com/b-38.html]format[/url] your code. It's really hard to follow. | |
Re: DaysFirst = How many days left in the first month DaysLast = essentially the day of the last month - 1 DaysMonth = number of days in each month between the two months Add them all together. Example: 4-May-2007 to 23-Sep-2007 DaysFirst = 27 (31 days in May - 4) … | |
Re: Personally, I'd read the test answers into a [INLINECODE]char*[/INLINECODE] rather than a C++ [INLINECODE]string[/INLINECODE]. A [INLINECODE]char*[/INLINECODE] must be defined to accommodate the total number of answers necessary, but a [INLINECODE]string[/INLINECODE] will read only the answers on the line. If a student doesn't answer the last 5 questions, the [INLINECODE]string[/INLINECODE] could … | |
Re: Use a loop to generate as many random numbers from 0 to 25 as you want and add the values to the string. When you get the random number, simply add 'a' to it and you will have all letters instead of 0-25 | |
Re: You need to read each line. The \n\n will take two lines. You can tell the second \n because the line will be extremely short. == may not be good, but < might work better. Depends on how consistent the blank lines are -- extra SPACEs for example. | |
Re: [QUOTE=appuguy;459179] -------------------Configuration: Test - Win32 Debug-------------------- Compiling... myfiletesting.c C:\Documents and Settings\HP_Administrator\myfiletesting.c(16) : warning C4029: declared formal parameter list different from definition C:\Documents and Settings\HP_Administrator\myfiletesting.c(28) : warning C4028: formal parameter 1 different from declaration[/quote] Look at the lines specified. You are calling a function, but the parameters do not match the … | |
Re: [QUOTE=people123;459073]how should i improve my formatting, can you please give me an example... i just get lost of what has to be where when im writing[/QUOTE] Here's a turotial on [url=http://www.gidnetwork.com/b-38.html]Formatting C / C++ code[/url] | |
Re: First things first -- put braces around everything that needs them -- around statements contained in [INLINECODE]if[/INLINECODE]s, [INLINECODE]else[/INLINECODE]s, [INLINECODE]switch[/INLINECODE]es, [INLINECODE]for[/INLINECODE]s, etc. And indent them properly. [I]Then [/I]we can see what's going on. | |
Re: I just did a quick check and found the following :icon_twisted: (this is mostly just in fun, don't get your knickers in a knot) [code] Some of my old problems are back Sep 29th 2007 3:38 pm Cursor is disappearing Sep 6th 2007 6:27 pm Scroll arrows won't repeat. Sep … | |
Re: Neither can we. You need to [url=http://www.gidnetwork.com/b-38.html]format[/url] your code, and use [url=http://www.daniweb.com/techtalkforums/announcement8-3.html]CODE[/url] tags. | |
Re: It doesn't. See [url]http://c-faq.com/expr/evalorder2.html[/url] | |
Re: [QUOTE=iamthwee;458275]>gets(name); [url]http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1049157810&id=1043284351[/url][/quote] Yes, [INLINECODE]gets()[/INLINECODE] is a very dangerous function, as is [INLINECODE]scanf("%s",...)[/INLINECODE] in exactly the same way. [QUOTE=iamthwee;458275]>clrscr(); Non portable[/quote] As is [INLINECODE]getch()[/INLINECODE]. Best to remove [I]conio.h[/I] completely and use no functions from it because most compilers won't be able to compile your programs. [QUOTE=iamthwee;458275]>while (!fil.eof()) Doesn't work as you … | |
Re: Look up the definition of a [INLINECODE]for [/INLINECODE]loop. What do each of the parts of the loop do? Do your parts comply? | |
Re: [QUOTE=people123;458251]Thanks a lot, may I ask what was the [inlinecode]std:string line;[/inlinecode] ...[/quote] Define the variable [I]line[/I] as a [B]string[/B] variable [QUOTE=people123;458251]... and the [inlinecode]getline(cin,line)[/inlinecode] for?[/QUOTE] [I]get[/I] a [I]line[/I] ([INLINECODE]getline()[/INLINECODE]) entered from the keyboard up to the \n and put it in the variable [I]line.[/I] | |
Re: [QUOTE=tracethepath;458655]sorry i have not read strings yet so didnt know... can you tell me more about that?? thanx...[/QUOTE] Then wait until you read about strings. Until then use [INLINECODE]strcmp()[/INLINECODE] or [INLINECODE]strncmp()[/INLINECODE] which works for your definitions. | |
Re: Try using a [INLINECODE]while [/INLINECODE]look for the first loop instead. A [INLINECODE]for [/INLINECODE]loop implies you know how many times you need to go through the loop. A [INLINECODE]while [/INLINECODE]implies you exit the loop when some criteria is satisfied, such as you reached the end-of-file ([INLINECODE]EOF[/INLINECODE]). Since you seem to know … | |
Re: [QUOTE=ithelp;458246]That is quite messy. Better move to perl/php[/QUOTE] Yes, it's quite messy because you used TABs for indentation instead of 3-4 SPACEs. Outside of that the formatting seems fine. And moving to Perl or PHP is one of the most asinine suggestions I've ever heard. Why would someone want to … | |
Re: Compilers [url=http://www.codeblocks.org/downloads.shtml]Code::Blocks[/url] [url=http://msdn.microsoft.com/vstudio/express/visualc/]MSVC++ Express[/url] [url=http://www.openwatcom.org/ftp/]Open Watcom C++/Fortran[/url] [url=http://www.bloodshed.net]Bloodshed DevC[/url] [url=http://www.borland.com/downloads/download_cbuilder.html]Borland 5.5[/url] Don't use Vista but they all work on XP. | |
Re: [QUOTE=cl3m0ns;458077]I have this program it allows the users to enter a name and a score it saves all the names to one array and all the scores to another. The program then displays all the names and scores in a list. I want to have the code for displaying the … | |
Re: [QUOTE=disc;457861]The try/catch block is already implemented in the DoIt function but that's not the solution because the exception is caused by a third party DLL. [/QUOTE] Talk to the third party. They have a better chance of figuring out what's going wrong. | |
Re: [QUOTE]You could try something like this: (pseudocode) int input, average, total, count; [CODE] while(count++) { ask for input ; if (input == 0) break; // 0 quits te program total += input; average = total / count; } printf ("Total = %d, Average =%d", total, average; [/CODE] You'll have to … | |
Re: [QUOTE=cscgal;456766]> How about saying that on the search page that you use a heuristic for performance reasons I think that it can pretty much be assumed whenever querying a huge dataset that some level of heuristics are involved. There would be no positive benefit to having such a disclaimer.[/QUOTE] No … | |
Re: [QUOTE=Duoas;457140]All the places where you have something like [inlinecode]/2[/inlinecode] check to make sure your numerator is a double [I]before[/I] division occurs. If it isn't, change your denominator to a double (say, [inlinecode]/2.0[/inlinecode]).[/QUOTE] Or, more generally, make sure at least one of the values being divided is a floating point value. | |
Re: [QUOTE=mt171406;457259]I am trying to develop a program that reads a list of integers from a file and outputs whether or not each integer in the file is perfect. Its suppose to give practice using endfile-controlled and for loops. [/QUOTE] I'd start by attempting something. Just opening a file and not … | |
Re: [QUOTE=warpstar;457353][code] _ _ _ _ function2(_ _ _ _ _ _ _ _ _ _ _ ); main{ int n[]= {4, 5, 6}; int *kptr ; kptr = function2( n ) ; } [/code] Fill in the blanks and you get: [code]int *function2( int array[ ]); or int *function2( int … | |
![]() | Re: Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25. |
Re: [QUOTE=vmanes;457053]Double check all your { } pairs, make sure you've not left an open set in main( ). That could lead the compiler to thinking you're trying to declare a function inside a function.[/quote] The easiest way to do this is to learn how to [url=http://www.gidnetwork.com/b-38.html]format your code[/url] correctly. | |
Re: [quote=profess69;266390]Hello anyone if you see this please reply fast: i need some major help with some programming and logic code through liberty basic, My project consist of making an ATM Program allowing the user to only enter the security code 3 times and it also prompts you to enter a … | |
Re: You need to describe the error. No one is going to spend an hour trying to find the error, then pour over [I]your[/I] code to fix it. [I]You[/I] need to describe the error and the circumstances with which it happens. | |
Re: Create your program as a [I]Command Line[/I] program, or whatever your compiler calls it. Build it creating an executable. Open a command prompt window [B]Start:Accessories:Command Prompt[/B]. Navigate to the directory -- sorry, folder -- the executable is created in. Enter the name of the executable. IOW -- You edit and … | |
Re: For 25 posts, you sure haven't been listening to posting suggestions. READ THE FAQ!!!! Titles are important READ THE "READ THIS BEFORE YOU POST" STICKY!!! How you ask helps how you are helped READ THE BBCODE STICKY!!! READ THE BACKGROUND ON THE BOX YOU TYPE YOUR MESSAGES IN!!!! How you … | |
Re: [QUOTE=niek_e;456554]It shouldn't that much of a challenge when you're allready able to write recursion :) - ask a user for input before you call your function - add a 3th var to the function which is the number of times the user just entered - in the function count down … | |
Re: [QUOTE=liphoso;456004]I have made a few changes but it really still does not do wat i was xpecting[/QUOTE] That's too bad. Unfortunately most of us aren't going to play with the program to try to figure out what it's not doing. You need to tell us what it's doing wrong. This … |
The End.