5,676 Posted Topics

Member Avatar for alcx88

[QUOTE=alcx88;1189950]I am having troubles getting my program to work. It is supposed to take integers from a file and put them into an array. Then it is supposed to sort them by the bubble sort algorithm. [/QUOTE] So are we supposed to figure out what kind of problems you're having? …

Member Avatar for Adak
0
131
Member Avatar for LMat619

[CODE] for(i = 0; i < g; i++) { bdays[i] = 1 + rand() % 365; for (j = 0; j < g; j++) { if (bdays[i] == bdays[j]) return 1; else i - 1; if (i == 0) return 0; } } [/CODE] This loop makes no sense at …

Member Avatar for WaltP
0
248
Member Avatar for bigdawgg

Unfortunately, because there is no formatting at all, few of us are going to take the time to find the equations you're talking about in almost 200 lines. [url=http://www.gidnetwork.com/b-38.html]Check this out[/url] and repost with a little more detail.

Member Avatar for jwenting
0
191
Member Avatar for CleanSanchez

In this prototype [iCODE]float sum (float (*) (float, int), int*, int s);[/icode] what are you trying to accomplish with the first parameter [ICODE]float (*) (float, int)[/ICODE]? Does the code have to be this complex or are you allowed to simplify it?

Member Avatar for CleanSanchez
0
832
Member Avatar for riahc3

[QUOTE=riahc3;1188702]This is a small project for school but I perfer that it stay standard so it can run on Windows, OSX, and Linux as I on a personal level use Windows AND Linux.[/QUOTE] If so, just use [ICODE]getchar()[/ICODE]. It's completely standard, All compilers know about it, it's totally portable.

Member Avatar for jephthah
0
1K
Member Avatar for Jeronim

First off, the include file should be [B]includs[/B], not [B]includs.cpp[/B] And it has to be included in each file that needs it.

Member Avatar for corby
0
100
Member Avatar for bbrradd

What constitutes the end of a sentence? Look for it and set a flag for [I]EndOfSentence[/I]. Then next letter you find, capitalize it and clear [I]EndOfSentence[/I].

Member Avatar for corby
0
1K
Member Avatar for Dani

Excellent!!! If I may humbly suggest a few visual suggestions, though: comments in green "Strings" and 'characters' in blue Numbers in dark blue Keywords in bold purple (no underline) All else is black C/C++ functions don't need to be colored, but if they are, use a dark color like maybe …

Member Avatar for Soren Werk
0
617
Member Avatar for urbangeek

[ICODE] if(tempch>=65 && tempch<=90)[/ICODE] [ICODE] tempch+=32;[/ICODE] [ICODE] if(str[count]>96 && str[count]<123)[/ICODE] What are these magic numbers? After all that discussion since last night about using the characters themselves ('A', 'z', ' ') you still post code with magic numbers? Seems AD and J just wasted a night trying to help. [QUOTE=urbangeek;1187007]But …

Member Avatar for WaltP
0
167
Member Avatar for pooja90 soni

[QUOTE=CppBuilder2006;1188427]>> how we make the software through c++? :) well, I buy or download a compiler, then I make a project & write a program in it. then I compile! ;)[/QUOTE] You mean I've been doing it wrong all these years? Bummer! :icon_twisted:

Member Avatar for jwenting
-2
158
Member Avatar for hosam2k

[QUOTE=rabidbadger;1188451]If you also strip out line #17 -- you're doing the output in your searchCount() function now -- you should be done.[/QUOTE] Actually, it would be better to strip the output out of the function. Let the function do its job (search) and only it's job. Let [ICODE]main()[/ICODE] decide when …

Member Avatar for Adak
0
144
Member Avatar for xcarbonx

I think what you have is basically fine for a start. You just have to have some way to exit your input loop -- maybe by entering a grade like -999 as the exit criteria. Keeping count of how many grades were entered makes the output loop easy.

Member Avatar for WaltP
0
120
Member Avatar for philipB

I see the following problems: 1) Using void main() -- [url=http://www.gidnetwork.com/b-66.html]see this[/url] 2) Your formatting is terrible -- [url=http://www.gidnetwork.com/b-38.html]see this[/url]. Without good formatting, code is very difficult to follow.

Member Avatar for WaltP
0
230
Member Avatar for deanus

[QUOTE=deanus;1187853]Hi, Are 2D arrays positioned in memory the same way as normal arrays? ex.: char names[2][5] = {"Dean", "Viky"}; If 'names' is memory location 3000, are the letters necessarily stored like this? ... [/QUOTE] An easy way to find out is to create the array in [ICODE]main()[/ICODE] then pass the …

Member Avatar for deanus
0
148
Member Avatar for LeonieJDB

From the list of active threads ([url=http://www.daniweb.com/forums/forum5.html]like here[/url]) click on the yellow [I]Start New thread[/I] button.

Member Avatar for oldgamesware
0
77
Member Avatar for bandit711
Re: help

[CODE]if (SAverage <= 100 && SAverage >= 90)[/CODE] How can [B]SAverage[/B] be greater than 100 AND less than 90 at the same time?

Member Avatar for chiwawa10
0
104
Member Avatar for OffbeatPatriot
Member Avatar for jwenting
1
212
Member Avatar for mbrinkley
Member Avatar for Ancient Dragon
0
119
Member Avatar for sunnynight

Then write your own [iCODE]atod()[/iCODE]. Conversion functions are simple since you have the numbers right there in your string.

Member Avatar for Banfa
1
6K
Member Avatar for bandit711

[QUOTE=bandit711;1187219]please help.[/QUOTE] Line 44 is [CODE]{[/CODE] What was it before you rewrite it? [QUOTE=bandit711;1187267]i even change it to this but still getting additional numbers. [/QUOTE] Changed what to what? Are we supposed to not only find your bug but also find your changes. And in this unformatted code that [B]Salem[/B] …

Member Avatar for bandit711
0
165
Member Avatar for vino4all
Member Avatar for Trents

[QUOTE=Trents;1183773]I've seen those, the only problem is I don't truly understand them so I don't know what is going on. Like I said, new to C++, maybe 3 months under my belt? I can simply rip an algorithm from somewhere and add my "filler" but then I have no clue …

Member Avatar for invisal
0
147
Member Avatar for PatrixCR
Member Avatar for happygeek
0
267
Member Avatar for commentator8
Member Avatar for timhuynh

Why are you trying to store the strings "false" and "true" into [I]double[/I] variables? And where did you define [B]P[/B]rintf()?

Member Avatar for chiwawa10
0
160
Member Avatar for J.Killa

All you are doing is moving 1 character at a time from [I]word[/I] into [I]backwards[/I] -- but you overwrite [I]backwards[/I] each time.

Member Avatar for WaltP
0
226
Member Avatar for pinsickle

you don't need a compiler on every computer. Just the .EXE file if it's a console program.

Member Avatar for pinsickle
0
81
Member Avatar for coding101

Simple. Read an entire line rather than a single character. Output the line to the file. If the first character in the line is \n, you're done. Nothing was entered.

Member Avatar for WaltP
0
221
Member Avatar for jigglymig1

The problem I see is: [code] dataFile.read(reinterpret_cast<char *>(&coach),sizeof(coach)); // you just read 1 record while(!dataFile.eof()) // Start a loop until you reach end { // of file. Output every character // from the start of 'coach' to the // end of memory since you never // read another thing from …

Member Avatar for WaltP
0
130
Member Avatar for tquiva

[QUOTE=tquiva;1186369]Please bare with me. I am still a newb at programming and this may seem a bit confusing, but I have many comments and debug lines. This is an extremely long code, but could the advanced programmers out there please help me out? [/quote] You really need to get rid …

Member Avatar for WaltP
0
405
Member Avatar for tquiva

The way to accomplish this task is to input everything as string. Then check the string character by character to make sure there are no bad chars entered. Then convert each value in the string to integers.

Member Avatar for Aia
0
3K
Member Avatar for techie929

Use the number of the node as part of the file name. File for Node 4 is Node04.txt for example. If you know stringstreams, you can generate the filename that way. If not, you can use [iCODE]ssprintf()[/iCODE]. Include the [I]cstdio[/I] header.

Member Avatar for WaltP
0
76
Member Avatar for xofth

[QUOTE=jonsca;1185660]Put in a [icode] cin.ignore()[/icode] after the [icode] ans = getche(); [/icode] line. The newline ('\n') from the when you entered y or n the first time was staying in the input stream and getting picked up by the getch() which took it as input and moved on. I don't …

Member Avatar for xofth
0
224
Member Avatar for sdgz747

You have a great idea -- Add code, test often, move on. And your formatting is really good. And comments! Wow!!!! When asking for help, a blanket "help me" is not good enough. You need to point out what you need help with and describe what's not working. In detail.

Member Avatar for WaltP
0
111
Member Avatar for corby

[QUOTE=tintin.iitk;1184560]What I am hinting is that, if the problem is only with the first input, there may be a problem with getline function in whichever compiler or platform you're using..[/QUOTE] [QUOTE=corby;1184852]hey thx for your help but it was the compiler's fault. all i need to add in before my first …

Member Avatar for corby
0
107
Member Avatar for Q8iEnG

I repeat: [QUOTE=Ancient Dragon;1179274]>>How to fix the problem, please? what problem?? [/QUOTE] You [B]must[/B] tell us the problem. Do [B]NOT[/B] just post code and ask us for a solution .

Member Avatar for WaltP
0
164
Member Avatar for mauryoung

My first question is who wrote these programs for you? They are all written by different people. Is your project supposed to copy code from someone else? And you need to tell us what help you need, otherwise you'll just get more code written by more people. Not a good …

Member Avatar for WaltP
0
229
Member Avatar for ssDimensionss

Since your examples are ambiguous, you need to be a little more explicit. Starting at 2.000, what values gets rounded up to 3.000? 2.001? 2.100? 2.5? If it's as low as anything > 2.000, simply add 1.0 and truncate.

Member Avatar for 0x69
0
6K
Member Avatar for mitch9654

You have a wrong concept IMO. When you input a number, convert it to double. Keep everything as a double. When you output the answer, just output the double. You want to stay away from strings as much as possible after the initial input. Also, any idea what the [B]i[/B] …

Member Avatar for chary8088
0
248
Member Avatar for method4ever

As [B]Salem[/B] said in his first post [QUOTE=Salem;1183344]First, indent your code. [url]http://sourceforge.net/apps/mediawiki/cpwiki/index.php?title=Indentation[/url][/QUOTE] Or if you don't like his link, [url=http://www.gidnetwork.com/b-38.html]use this one[/url]. The reason is 1) you want our help 2) you post code we cannot read 3) if we can't read it, we can't help. Think about it. As …

Member Avatar for method4ever
0
190
Member Avatar for Superstar288

Go to a local computer shop that's been around for years and have them build one for you. They will provide service you can't get from the Big Names.

Member Avatar for jwenting
0
183
Member Avatar for angel19

If you can't tell if it needs improvements, how can we tell? When posting code/questions, you need to tell us what you need help with, not leave it to us to figure out if something is wrong.

Member Avatar for mn.balakumar
0
3K
Member Avatar for William Byrd II

You can't use a string object with [iCODE]strcmp()[/iCODE]. 2 solutions: 1) use the compare method that's part of the string object 2) convert the string object to char* with [I]stringname.[/I][B]c_str()[/B]

Member Avatar for chary8088
0
102
Member Avatar for vizionary2012

Actually, there is no [I]iostream[/I] in C. It is a C++ feature, and certainly is in Dev-C++

Member Avatar for Ancient Dragon
0
58
Member Avatar for EgyCoder

I'd be more interested in knowing why you need [iCODE]seekg()[/iCODE]. This doesn't look like a binary search. Just looks like you're bouncing around a file for the sake of bouncing where just reading the file would be more efficient and less error-prone.

Member Avatar for EgyCoder
0
206
Member Avatar for tquiva

In general [CODE]for (i=0; i<10; i++) { .... } [/CODE] becomes [CODE]i=0; while (i < 10) { .... i++; } [/CODE] In other syntax: [CODE]for ( A; B; C) { } [/CODE] becomes [CODE]A; while(B) { C; }[/CODE]

Member Avatar for tquiva
0
145
Member Avatar for bbrradd

Look up the functions [ICODE]isdigit()[/ICODE] and [ICODE]ispunct()[/ICODE] in [I]ctype.h[/I] or [I]cctype[/I] headers.

Member Avatar for WaltP
0
1K
Member Avatar for 3cats
Member Avatar for aay
Member Avatar for jeffrey o

-- wrong, oops --- And please [url=http://www.gidnetwork.com/b-38.html]format your code[/url]. It's very hard to follow.

Member Avatar for WaltP
0
113

The End.