5,676 Posted Topics
Re: Start by opening the input file, read each line/word and output it to the screen. When file is done, close the file and exit. | |
Re: You can't. You need to read old and write new. | |
Re: Shouldn't the input be more along the lines of: [code] sum = 0 + 12 sum = 12 - 2 sum = 10 + 5 sum = 15 [/code] It doesn't make sense to me to have a full equation added to the sum. | |
Re: Calling a class function is identical to calling a regular function. Please learn to [url=http://www.gidnetwork.com/b-38.html]format your code[/url] to make it understandable and use CODE Tags. | |
Re: [QUOTE=unubar;]Instead of: [CODE] for ( int j = 2; j <= num; j++){ [/CODE] use [CODE] for ( int j = 2; j <= sqrt(num); j++){ [/CODE] This will shorten the run time by a large magnitude. Regards, Ubaidullah Nubar.[/QUOTE] No it won't, Every time you go through the loop, … | |
Re: Since we can't see what you tried, and, to be honest, I have no idea what you're trying to do since cout is so easy to use, back up and give us a clear, precice explanation with an clear example. | |
Re: Your best bet is to ask your instructor. Since he's requiring you to use Turbo C, he's your best resource to fix the problem. | |
Re: [QUOTE=Masas;1356178]I posted my code an hour ago too so how do you know what I have changed and what not. [/QUOTE] Then why are you asking for more help if you aren't telling us the current state of the program? Aren't you asking us to shoot a moving target -- … | |
Re: Why would you want to "display" the question "[I]in another text file[/I]"? Don't you need it on the screen so the person can read the question and answer it? For your struct, what do you think you need in it? | |
Re: Major thing to correct is [url=http://www.gidnetwork.com/b-38.html]formatting[/url]. You have none. Because of that your code is too hard to follow. | |
Re: Yes I could but that's like transforming a 2010 Mercedes Benz into a 1975 Ford Pinto. Why would you possibly take a good construct and turn it into an extremely bad construct? | |
Re: [CODE] for(int i=0; i<size; ++i) { if(text[i] == '\n') height += 1; } [/code] If there are \n characters in your text array, this loop will count them. Is [I]height[/I] initialized properly? [code] for(int i=0; i < size; ++i) if(text[i] != '\n') width += 1; [/CODE] All this does is … | |
Re: [QUOTE=joydsouza90;298797]how do you fill an object such as a rectangle with a colour using setfillstyle(); ?? I dont want to use flood fill as i am having more problems with that..[/QUOTE] You don't. [INLINECODE]setfillstyle()[/INLINECODE] simply [I]set[/I]s the type of fill. You still need a function that actually [I]perform[/I]s the filling, … | |
Re: You're writing C which simulates a string with a character array. You can't use = to assign arrays. Look up [iCODE]string.h[/iCODE] functions... | |
Re: Look very carefully at line 13: [CODE]while(a[i] != '\n'|| i != 80)[/CODE] Think about the truth table this statement generates. | |
Re: Help with what? You didn't tell us what you are having trouble with, nor what part of the code has a problem. | |
Re: You sure typed a lot of stuff, but I can't figure out what your problem actually is. It sounds like you tried every type of input possible, and nothing does what you want. So explain what you want, not just what didn't work. | |
Re: [QUOTE=aviavyne;]It is a good practice to not use the system("pause"), the reason is that this will only work on a windows, and if you take it to another computer it won't work. Try using a fflush(stdin); followed by cin.get();[/QUOTE] It's also a bad practice to use [icode]fflush(stdin)[/icode] because it's a … | |
Re: There is no information in your description that we can even guess at the problem. Try looking at the code that generates the message and see what conditions prevent the data from being loaded. | |
Re: Help with what? 169 lines and not on;ly are we supposed to guess what lines have errors, but we have to guess the errors too? What's the first question your instructor will ask if all you say is "[I]I have a problem[/I]"? Answer the question when you post to save … | |
Re: Good for you! Next time, use CODE Tags, though. | |
Re: We were in the final season last season.... Anyway, when should Smallville end, when Welling is 50? We need a Superman long before then! He's already 33! | |
Re: [QUOTE=Hey11] plz help , whats wrong in the code ??[/QUOTE] Here's what I see wrong: 1) Bad formatting, making the code hard to follow ([url=http://www.gidnetwork.com/b-38.html]see this[/url]) 2) Using [ICODE]system("pause");[/ICODE] ([url=http://www.gidnetwork.com/b-43.html]see this[/url]) 3) Incrementing the FOR loop counter within the FOR loop. The first two are not quite what you were … | |
Re: I don't see where you loaded any values into the timer object. | |
Re: What help do you need? When you ask for help, you need to describe a problem. | |
Re: Sound to me you should talk to your instructor and find out what you missed. He's in a better position to give you the help you need. All we can do is answer questions you ask, but we're not in a position to teach you what you missed. | |
Re: Yeah, so? What is [icode]int main(void)[/icode] supposed to do? How about [ICODE]void menu(void)[/ICODE]? Is there a reason for [ICODE]int getChoice(void)[/ICODE]? etc. So start with what he wants. Figure out what the functions are supposed to do. Add code in short segments. And compile often. | |
Re: I don't understand why people (sonsofliberty84) insist on difficult solutions to simple problems, but many people like to water their lawn by blowing up the dam. A simple array, a simple loop, 2 IF statements, and [I]formatted[/I] is all you need. No vectors necessary. | |
Re: Still can't read the code with 20 TABs for indentation. Convert all your TABs to 4 spaces which is a standard spacing for code. You might want to [url=http://www.gidnetwork.com/b-38.html]see this[/url] | |
Re: Neither are we. You didn't describe the problem. And most people will not download attachments. | |
Re: [QUOTE=stud02;]I have a working c file which count lines from a text file. Is there a function that filters out lines with comments(lines started with //)? So when I load in a text file with a c code, it only has to count the lines without comment.[/QUOTE] No. That's the … | |
Re: Is length of str1 less than length of str2? If so, exit with not found. Look through the characters in str2 for the first character in str1. If not found, exit, otherwise... Are the next chars in str2 the same as str1? | |
Re: Yes, you are wrong. Look closer at the name of the function -- [I]get[B]line[/B]()[/I]. Look up I/O techniques, try something, and if it doesn't work, post what you tried. One technique is to read a character and save it, read another and ignore it, read the rest of the line. … | |
Re: [QUOTE=DrueY;]Error C2057: expected constant expression Error C2466: cannot allocate an array of constant size 0 Error C2133: 'inc': unknown size Why? Here's the code: [/QUOTE] What lines? | |
Re: Never -- NEVER -- [B]NEVER[/B] call [iCODE]main()[/iCODE] to return from a function!!! Never!! Modularize your program. Create subroutines that do a single part of the task and call them, like 1) Generate the list of numbers 2) Read the list 3) Test for palindrome etc. Then you can work in … | |
Re: 1) Do not bump threads 2) Give [I]enough information[/I] for us to understand the problem 3) Read the Member Rules | |
Re: [QUOTE=Narue;180366]>Plz answer my these C doubts- "Doubt" is sometimes synonymous with "question", but not in this case. It's very common to ignorantly use doubt in place of question, and it's usually wrong. What you have a C questions, not C doubts.[/QUOTE] I think this is something taught in India. The … | |
Re: Stop bumping your thread. It's rude! We are not staff waiting to answer your question, we are volunteers that have lives. We'll get to you when we log in and have an answer for you. | |
Re: Absolutely. Come up with an idea and we'll help you fine tune it. | |
Re: Neither do we since "an error" is a useless explanation of the problem and there is no formatting at all making the program hard to follow. See: [url=http://www.gidnetwork.com/b-38.html]this[/url], [url=http://www.gidnetwork.com/b-56.html]this[/url], and [url=http://www.gidnetwork.com/b-58.html]this[/url] | |
Re: [QUOTE=BecomingPro;] Could anyone help by telling me how I can add to it so it also counts upper case letters and also numbers 0-9? [/QUOTE] What does [CODE]for(char ch='a'; ch <= 'z'; ++ch)[/CODE] do? Maybe something similar would work? | |
| |
Re: Load the appropriate properties from the drivelist into the filelist properties when you change the drivelist. | |
Re: Read the documentation for "[I]The unix utility application that strips the HTML markup tags from the file’s content leaving just content text[/I]" | |
Re: [QUOTE=baconswife;]How do I fix what I did? I don't even really know what I did wrong. [/QUOTE] That depends completely on what seems to be wrong now. Care to elaborate? | |
Re: First thing I'd do is create a function that simply outputs a board and call that instead of hard coding it in other functions. Then, add output statements to follow your program (or use the debugger) to see where the problem shows up. | |
Re: Consider: [QUOTE=lou38;]Assume that the first integer read specifies the number of values remaining to be entered and that the first number is not one of the integers to compare. [/quote] What is the purpose of the first number to be read? How would you use it? What is the purpose … | |
Re: Without knowing what the error is and where the error is, no. | |
Re: Well, you open a file to read, then you read the data from the keyboard -- that's what [iCODE]cin[/iCODE] does. |
The End.