5,676 Posted Topics
Re: [QUOTE=bensewards;] I have a question about: infile >> names[i] >> grade [i]; Will this go through the first line of the file and put the name in names[] and the gpa in grade[], then repeat with i++?[/quote] What happened when you tried it? That's easier and faster than posting on … | |
Re: No, do not use [iCODE]getch()[/iCODE]. That is a non-standard C function (not even C++) in only a couple compilers. Use [B]gerard[/B]'s solution. | |
Re: [QUOTE=Foxfreezer;1454326]thanks for the thorough response ravenous and red goose. I have a quick question regarding your reply ravenous, when you said: /* Check through things in argv here */ what exactly do you mean? I'm confused as to how I check things through. Thanks![/QUOTE] argv[] is an array. Check argv[1], … | |
Re: Would you mind defining what "doesn't work" means? Don't know whether that means it doesn't compile, displays the wrong numbers, causes a citywide blackout. Details. Exactly what does it do, and what were you expecting? | |
Re: When you find an ad that does this type of thing, do you remove the ad as a violation until fixed? | |
Re: Use CODE Tags -- they are described all over this site. Including on the background of the box in which you typed your question. Please read the following information: [url=http://www.gidnetwork.com/b-38.html]formatting[/url] [url=http://www.gidnetwork.com/b-66.html]void main()[/url] [url=http://www.gidnetwork.com/b-43.html]pausing a program[/url] | |
Re: CODE Tags on the first post!!!! How did you happen to figure that out? Great!!!! :icon_mrgreen: Please [url=http://www.gidnetwork.com/b-38.html]FORMAT[/url] your code properly. Change your IDE to replace TABs with 4 SPACEs. It is very difficult to read your code the way it's posted. Don't you enter a single letter when asked? … | |
Re: You'd be better off reading the entire line and looking through the array rather than trying to mess around with complex file reading techniques. If you can read the entire file, so much the better. | |
Re: [QUOTE=Violet_82;]Hi there,[/quote] Hi. [QUOTE=Violet_82;]I have done a small exercise (ex 4.17 on C++ how to program - deitel and deitel) which basically is about writing a program that uses a while statement to determine and print the largest number of 10 numbers input by the user. The program should use … | |
Re: If the number must be [I]exactly[/I] 5 digits, you'd be better off reading the number as a string and passing it into your function. By reading an int, you have the possibility of an error on the read if they type in a non-digit character. Reading a string removes that … | |
Re: Look up the functions RIGHT() LEFT() MID() and LEN(). | |
Re: When is [iCODE]department == ""[/iCODE]? Are you [I]sure[/I]? If tests don't work, you need to verify the variable values. Output them, or use the debugger. | |
Re: Is this a joke? Not only do you 1) resurrect and hijack an old thread 2) not use CODE Tags 3) post over 2000 lines of bad code 4) use a compiler and functions that haven't been used in 20 years you also expect us to read it, understand what … | |
Re: So what's the value of [iCODE]w->name[/iCODE] after you read it? When asking a question, give us ALL the details necessary to understand the problem. For example, how do you know that statement is the problem? | |
Re: [QUOTE=HENRYSUGAR;]it is already included mate[/QUOTE] Look again, mate... | |
Re: If you can't give us any more information than just posting almost 200 lines of uncommented code with no indication what's wrong, where it's wrong, and not using CODE tags, then there's no real help we can give. | |
Re: Try thinking about the answer. Where do YOU think the output makes sense? | |
Re: Since you seem to be getting answers that don't come close to a solution, maybe you need to describe again more clearly and in detail what you are trying to accomplish. | |
Re: An INI file is just a file that you define. It's a text file containing the data you want to write to it. It's not a [I]special file[/I], it just has a different extension -- .INI | |
Re: [CODE]while (select < 'A' || select > 'E')[/CODE] Single quotes denote the character | |
Re: [QUOTE=Violet_82;] I noticed you guys on this forum don't use [CODE]using namespace std;[/CODE] but I thought it was more a matter of style other than anything else...[/QUOTE] You will notice if you actually look at this forum that we DO use [iCODE]using namespace std;[/iCODE]. Many of us don't necessarily subscribe … | |
Re: Dev C [I]is[/I] a C++ compiler. But, like most compilers, it can compile strict C programs as well. And yes, given the right knowledge, you will be able to write the program you want. | |
Re: Yes, [B]firstPerson[/B] is correct. [iCODE]srand()[/iCODE] should be called only once, at the beginning of [iCODE]main()[/iCODE]. | |
Re: [B]Stop trying to fix his code![/B] It's correct. The problem is your terminology. You said [QUOTE=PCSAWICK829;]From that point, I go to the command line and after making sure I'm in the correct directory, i type "gcc dumb.c -o dumb" (no quotations obviously) and that's how i run the program.[/QUOTE] That … | |
Re: [QUOTE=gerard4143;]A quick inspection of the code reveals that your not resetting the variable judgeCounter back to zero. A note on code indentation...Please use it. [/QUOTE] Yes, but don't use [B]gerard[/B]'s formatting. Indent 4 spaces, not a full TAB. TABs make the code hard to read. Your IDE can be set … | |
Re: [iCODE]toupper()[/iCODE] is working fine. You just didn't store the result anywhere, throwing away the modified character. As for [iCODE]line.size[/iCODE], what was input, what is the result, what were you expecting? Remember to give the details necessary for full understanding. Otherwise you get guesses and inadequate help. | |
Re: [QUOTE=saleh-elyani;1444412]Hi everybody I wrote this code in my university assignment . But I want to change the global variable (the variables that above the main) to local variable (inside the main) and add the parameters in the functions.[/QUOTE] Ummm, OK. So do it... | |
Re: [QUOTE=firstPerson;]You can use [icode]cin.get()[/icode] to read each individual characters from the stream.[/QUOTE] [QUOTE=jonsca;]... read it in as a string and access the digits as characters...[/QUOTE] How do these suggestions support [QUOTE=MrJNV;]If a user inputs a [B]int[/B] number, say 150...[/QUOTE]:icon_question: :icon_rolleyes: As [B]jonsca[/B] alluded to, look up the modulus (%) operator. … | |
Re: [QUOTE=Lerner;481629]First thing is try a little harder to get the indentation consistent. Code is much easier to debug when it's consistently formatted. [/QUOTE] And to help you with this, [url=http://www.gidnetwork.com/b-38.html]here's some help[/url] | |
Re: [B]I don't have any problems there. Then why the hell are you hijackingRickay's thread for an unrelated question? Start your own thread! But the real problem I'm having is how can I tell once I can stop multiplying the number by ten? See, your problem is unrelated. Leave this thread … | |
Re: Output [B]d[/B] as a hex value, or use a decimal-hex calculator to check the answer. | |
Re: NULL is 0. There is no distinction between a variable with no value vs. 0. As [B]jonsca[/B] said define a value as your "no value" number. | |
Re: How about giving an example of exactly what you want. Telling us it works 121314 doesn't tell us what is correct. Examples help. | |
Re: Another example: You want to know what lights are on in your computerized home. Bits: 0- Front Porch 1- Entryway 2- Living Room 3- Dining Room 4- Kitchen 5- Bathroom 6- Master Bedroom 7- Kids Bedroom In the [I]lights byte[/I] you have [CODE]Byte value 00110101 Bit numbers 76543210 [/CODE] Which … | |
Re: Don't call [iCODE]main()[/iCODE] from your functions. [iCODE]return[/iCODE] instead. | |
| |
Re: Next time EDIT or DELETE the other post. Don't just leave it for us to clean up. | |
Re: [CODE] puts("please enter a file name to create:\n"); scanf("%s", &file_name); // Never use scanf() to read a string. It's dangerous. Use fgets() if( create_pointer = fopen(file_name. "r"); printf("file already exist"); else { if(create_pointer != fopen(file_name"r"); // Didn't the previous fopen already check for this? create_pointer = fopen( file_name, "ab"); } … | |
Re: Get a random value MOD 2. If 0, output to [I]out1.txt[/I]. If 1, [I]out2.txt[/I]. | |
Re: Then convert all values into individual digits in an integer array. Then you can ignore the fact that floating point values are not exact. | |
Re: Why not just make an icon for the program and put the in the STARTUP folder of the program list? This way you won't destroy your registry file if you get the code wrong. | |
Re: I can't even follow your code with the formatting you have. Please [url=http://www.gidnetwork.com/b-38.html]re-format[/url] and post again. | |
Re: You didn't type the filename in properly. And after 3 years, are you even sure [B]prushik[/B] is even around? | |
Re: 1) Format your code properly -- [url=http://www.gidnetwork.com/b-38.html]How to do it[/url]. Concentrate in INDENTING. 2) We aren't Psychic! "[I]there is still errors[/I]" is no help at all. Are we supposed to [B]guess[/B] what the errors are? |
The End.