5,676 Posted Topics

Member Avatar for tech9x

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.

Member Avatar for WaltP
0
113
Member Avatar for Tellalca
Member Avatar for emko

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.

Member Avatar for emko
0
398
Member Avatar for ZIPB

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.

Member Avatar for VernonDozier
0
146
Member Avatar for miha2

[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, …

Member Avatar for miha2
0
2K
Member Avatar for fantasma

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.

Member Avatar for fantasma
0
153
Member Avatar for mushahidh

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.

Member Avatar for Taywin
0
154
Member Avatar for Masas

[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 -- …

Member Avatar for savdapu krishna
0
288
Member Avatar for emmas4impact

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?

Member Avatar for Adak
0
99
Member Avatar for atramposch

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.

Member Avatar for gerard4143
0
149
Member Avatar for howzat

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?

Member Avatar for WaltP
-1
32
Member Avatar for baltair

[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 …

Member Avatar for baltair
0
291
Member Avatar for joydsouza90

[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, …

Member Avatar for 007himanshujain
0
76
Member Avatar for Vininski

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...

Member Avatar for Vininski
0
251
Member Avatar for DA_BKJ

Look very carefully at line 13: [CODE]while(a[i] != '\n'|| i != 80)[/CODE] Think about the truth table this statement generates.

Member Avatar for DA_BKJ
0
2K
Member Avatar for reallynewbie

Help with what? You didn't tell us what you are having trouble with, nor what part of the code has a problem.

Member Avatar for reallynewbie
0
56
Member Avatar for goodi8u

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.

Member Avatar for goodi8u
0
248
Member Avatar for koolman123

[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 …

Member Avatar for Fbody
0
223
Member Avatar for The Hisel

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.

Member Avatar for The Hisel
0
101
Member Avatar for kazuki05

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 …

Member Avatar for Anyzen
0
110
Member Avatar for twitchybear
Member Avatar for Dani

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!

Member Avatar for WASDted
0
231
Member Avatar for Hey11

[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 …

Member Avatar for myk45
0
108
Member Avatar for DCYPHER
Member Avatar for nickx522

What help do you need? When you ask for help, you need to describe a problem.

Member Avatar for WaltP
0
203
Member Avatar for allizzee

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.

Member Avatar for WaltP
0
116
Member Avatar for jalenamichelle

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.

Member Avatar for WaltP
0
98
Member Avatar for dwhite459

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.

Member Avatar for WaltP
0
6K
Member Avatar for rashmideesh

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]

Member Avatar for Adak
0
171
Member Avatar for bpress91

Neither are we. You didn't describe the problem. And most people will not download attachments.

Member Avatar for technologic
0
43
Member Avatar for stud02

[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 …

Member Avatar for WaltP
0
133
Member Avatar for brendono978

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?

Member Avatar for brendono978
0
1K
Member Avatar for Lightslei

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. …

Member Avatar for WaltP
0
121
Member Avatar for DrueY

[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?

Member Avatar for DrueY
0
317
Member Avatar for globberbob

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 …

Member Avatar for globberbob
0
327
Member Avatar for tech9x

1) Do not bump threads 2) Give [I]enough information[/I] for us to understand the problem 3) Read the Member Rules

Member Avatar for vijayan121
0
4K
Member Avatar for akshayabc

[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 …

Member Avatar for gayathri balu
0
180
Member Avatar for realproskater

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.

Member Avatar for realproskater
0
584
Member Avatar for dbirely

Absolutely. Come up with an idea and we'll help you fine tune it.

Member Avatar for dbirely
0
140
Member Avatar for danish_izads

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]

Member Avatar for danish_izads
0
183
Member Avatar for BecomingPro

[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?

Member Avatar for WaltP
0
118
Member Avatar for penny90
Member Avatar for mebrahtom
Member Avatar for nagatron

Load the appropriate properties from the drivelist into the filelist properties when you change the drivelist.

Member Avatar for nagatron
0
148
Member Avatar for avataralien

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]"

Member Avatar for shibblez
0
569
Member Avatar for baconswife

[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?

Member Avatar for Fbody
0
2K
Member Avatar for gotjeff5

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.

Member Avatar for Intrade
0
140
Member Avatar for lou38

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 …

Member Avatar for WaltP
0
460
Member Avatar for heidik
Member Avatar for ixmike88
0
144
Member Avatar for WhoCares357

Well, you open a file to read, then you read the data from the keyboard -- that's what [iCODE]cin[/iCODE] does.

Member Avatar for WhoCares357
0
593

The End.