5,676 Posted Topics

Member Avatar for Metalsiege

[B]John[/B] is correct on both counts. Change that nested IF into a switch and it'll be easier to read. I see a [ICODE]while[/ICODE] statement in [ICODE]case 1:[/ICODE] -- what is that supposed to be doing?

Member Avatar for Metalsiege
0
190
Member Avatar for demroth

[QUOTE=demroth;546031]Ok, here is what I have now. I am still getting errors when it comes to calling the function and passing the values.[/QUOTE] Such as? :icon_rolleyes: Psychically debugging code is hit or miss proposition. Mostly miss. Unless you give us information, there's not much we can do...

Member Avatar for demroth
0
160
Member Avatar for ankitbullu

We don't give code as answers to questions. We help you with the code you write. So try it and reply with your attempt.

Member Avatar for Duoas
0
110
Member Avatar for Jellis58

And you should have read The Rules. PERIOD. Well, comma, actually. Are you asking us to supply a program for you or help you write something? Would an Excel Spreadsheet be enough, or do you need a program?

Member Avatar for Jellis58
0
84
Member Avatar for sfurlow2

Guys, guys, we're supposed to be 'experts' here! :D #1: You are using a [ICODE]for[/ICODE] loop but your exit criteria of the loop depends on [I]counter[/I] and [I]limit[/I]. Your instructions say "[I]when the user enters a negative number or zero[/I]" and [I]counter [/I]has no bearing on the exit. #2: After …

Member Avatar for pmvignesh
0
168
Member Avatar for sfurlow2

[QUOTE=sfurlow2;546616](I'll accept any reasonable solution to handling the first two numbers)[/quote]So nice of you :icon_wink: [QUOTE=sfurlow2;546616]This isn't working for me, and I'm not sure how to fix it or how to get the average of only the last three inputted numbers.[/QUOTE] Is there something about explaining why you think it …

Member Avatar for sfurlow2
0
805
Member Avatar for Jboy05
Member Avatar for Ancient Dragon
0
115
Member Avatar for darknight09

Since I've never heard of [I]Bingo/Chess[/I] and have no idea what that means, there's not much I can do from a logic standpoint. And since there is absolutely no [url=http://www.gidnetwork.com/b-38.html]formatting[/url] in your code, there is no way I can understand what you have written. Post enough information about your problem …

Member Avatar for darknight09
0
252
Member Avatar for bwjones

First of all, don't use ICODE tags unless you want to show code inline with your message. Your code is not too bad, but here are some comments for you to think about: [CODE=c] if (input[b] >= 85) { hcnt = hcnt +1; // you can also use hcnt++; inp …

Member Avatar for bwjones
0
187
Member Avatar for Ryuji5864

[QUOTE=cscgal;546941]That's because when there is only one line, brackets are implied and therefore not needed. (Although I would recommend them, especially when starting out.)[/QUOTE] Completely agree! [I]Always [/I]use brackets within an [ICODE]if[/ICODE] statement [QUOTE=Lerner;546907]Welcome to Daniweb![/quote] Yeah, what he said! :) [QUOTE=Lerner;546907]The error message probably means that you should have …

Member Avatar for Ryuji5864
0
175
Member Avatar for darknight09

This is C code not C++. That's probably why he posted it in theC forum... :icon_wink:

Member Avatar for zhelih
0
107
Member Avatar for Moporho

You need to look more closely at where your loop is. Your code: [code] input a number test your operator (it was never entered) process the operator start a loop input operator if operator is illegal output error else input number end loop ... [/code] You never test any operator …

Member Avatar for WaltP
0
191
Member Avatar for sfurlow2

[CODE]#include "stub.h" int main() { int x = 0; int highest_pos = 0; int lowest_pos; int counter; int highest_neg; int lowest_neg; [/CODE] The values [I]lowest_pos, counter, highest_neg[/I], and [I]lowest_neg[/I] start with unknown values. They could be 0, or 165432343, or -8554545487. You need to initialize them to some appropriate value. …

Member Avatar for WaltP
0
93
Member Avatar for msaenz

Well, it's not a placeholder. You are defining arrays with no rows and no columns. There is no place for data. So once you try to put anything in your arrays, you overwrite memory changing data you shouldn't and will definitely screw up the program and probably crash.

Member Avatar for WaltP
0
112
Member Avatar for nikita_knp

[QUOTE=nikita_knp;543376]hey actually i have to design a text editor in turbo C.. i havent made the code yet... plaese help me out.. or if anyone does have it plaese mail me at [email removed][/QUOTE] Help you with what? The design? Giving you code? How about starting with the design as …

Member Avatar for rizwan_aman007
0
160
Member Avatar for Matt You

By not using [ICODE]scanf()[/ICODE] to input your data. [url=http://www.gidnetwork.com/b-59.html]See this series[/url] to see why, and how to fix it.

Member Avatar for Matt You
0
121
Member Avatar for noble3ad

Yes, you need a loop and a counter to count how many time your loop executes. Exit when counter == 5 OR guess == random_number Also be careful using = and == They are not the same and you have to use the right one for the right purpose.

Member Avatar for noble3ad
1
115
Member Avatar for WaltP

Lately I've been seeing the following: Today I was looking at forums until about 2:45PM. This evening about 7:30PM I clicked on the [I]Go to first new post[/I] on various threads. I scroll up to previous posts and see many that have been added from 4PM on. Why are these …

Member Avatar for Dani
0
345
Member Avatar for ghost_squad7

The way to do it in Turbo C is to use the functions [ICODE]kbhit()[/ICODE] and [ICODE]getch()[/ICODE]. You will not be using the [I]scan[/I] functions because they will stop the program. Anyway, you should [I]never[/I] use the [ICODE]scanf()[/ICODE] to read a string. [url=http://www.gidnetwork.com/b-62.html]Here's why[/url]. It would be useful to read the …

Member Avatar for WaltP
0
469
Member Avatar for rohoni

See these links: #1) [url=http://www.gidnetwork.com/b-66.html]void main()[/url] #2) [url=http://www.gidnetwork.com/b-60.html]scanf("%c"...);[/url] #3) [url=http://www.daniweb.com/techtalkforums/announcement8-3.html]Code Tags[/url] #4) Works for me

Member Avatar for gerard4143
0
97
Member Avatar for behnaz

With todays compilers, you don't. Those headers are no longer used.

Member Avatar for WaltP
0
68
Member Avatar for Jboy05

[QUOTE=vijayan121;545050] got impatient ant tried it on a compiler. seems to work alright. [/QUOTE] Gee, maybe you should try that [I]first[/I] next time... :icon_rolleyes:

Member Avatar for vijayan121
0
118
Member Avatar for behnaz

[QUOTE=krnekhelesh;543922]I can help you. I have been using Turbo C++ and Borland C++ for the past 2 years. However please note that you cannot use Turbo C++ to output any sort of graphics as BGI graphics is not supported in windows.[/QUOTE] Not true. BGI works just fine at least through …

Member Avatar for Duoas
0
160
Member Avatar for rohoni

I'd start with [b]plgriffith[/b]'s program and make a minor change [code] #include <stdio.h> int main() { char buf[] = "abcdeedcba\nabcdxxdcba\nabcxxxxcba\nabxxxxxxba\naxxxxxxxxa\n"; int i; i = 0; while (buf[i]) { putchar (buf[i++]); } return 0; } [/code]

Member Avatar for WaltP
0
129
Member Avatar for Google Spider

Problem #1: [QUOTE=Google Spider;543799]I'm not very good at structs and classes and haven't tried any problems, just read it from the book. [/QUOTE] Then you are not learning. All you're doing is reading which by itself is worthless. Start at the beginning of the book and do the work after …

Member Avatar for codeaa
0
159
Member Avatar for cosmos22

What [B]krnekhelesh[/B] said, except it's [I]ifstream[/I] since [I]use[/I] implies read, not write. To answer the rest of the question, searching your entire disk for the file is 1) difficult to program 2) time consuming to run Best to just read the file from a specific location.

Member Avatar for vijayan121
0
109
Member Avatar for smiles
Member Avatar for VernonDozier
0
106
Member Avatar for mechbas

[QUOTE=MidiMagic;532579]Get rid of this feature! There are times when ISPs go down. To blacklist someone because an ISP is down is RIDICULOUS! I can't change my email address without losing a lot of money.[/QUOTE] How can you lose money by changing your email address to DaniWeb? Just get a yahoo …

Member Avatar for Dani
0
197
Member Avatar for imnolongerhere

Well, the first thing "TO DO" is to decide what you need "to do" for each section you labeled "TO DO". That is the first part of your assignment. Once you figure that out, we can help you implement the code (starting of course with your attempt).

Member Avatar for WaltP
0
92
Member Avatar for curt1203

> I have my code written very nice on my compiler with proper spacing and good alignment, how do i put it on daniweb so it looks like my compiler. everytime i make a thread and space it right the preview of the post looks messed up.... 1) You could …

Member Avatar for curt1203
0
250
Member Avatar for vishalkhialani

A "database" does not have to be a pre-written data management system. It can be a file or three that contains the data you need for a project, and a few routines you write to access the data. Use the KISS principle ([B]K[/B]eep [B]I[/B]t [B]S[/B]imple [B]S[/B]tupid).

Member Avatar for vishalkhialani
0
164
Member Avatar for mistercow.pnoy

[QUOTE=VernonDozier;535891]In C++, that would be something like this: [code=C++] if (m % n == 0) { // code to flag n as a factor of m } [/code][/QUOTE] Another option if you don't know the % operator is [code=C++] if ( ((m/n) * n) == m) { // n is …

Member Avatar for Nemoticchigga
0
121
Member Avatar for jimJohnson

After 23 posts, did you ever notice there were words on the background of the textbox you enter all your posts? They also explain CODE tags. So do various threads at the top of the forums, and the Rules.

Member Avatar for WaltP
0
288
Member Avatar for neclark2

[QUOTE=DangerDev;535067]u can also getch() but it doesnot work in some compiler.[/QUOTE] Why do people insist on making bad suggestions, especially after a good suggestion has been made? And if you read the Rules, they request [B]you[/B] use the word [B]you[/B], not the letter [I]u[/I], so people that don't speak English …

Member Avatar for DangerDev
0
117
Member Avatar for pitbro

Yes. Each letter has a numeric value. 'A' = 65, 'B' = 66, ... 'Z' = 90. So you can use a loop of some kind.

Member Avatar for Ancient Dragon
0
153
Member Avatar for Roebuc

Try an IF statement. If that doesn't help, you'll have to post your code so we can actually [I]see[/I] what you're trying to do.

Member Avatar for Roebuc
0
135
Member Avatar for pitbro
Member Avatar for k2k

Use [B].find()[/B] to find the spaces. If you find 2 spaces with 4 characters between them, use [B].replace() [/B]to replace the 4 characters. And remember, the end of the sentence may not end in a space, but it [I]may[/I] end in a 4-letter word.

Member Avatar for WaltP
0
359
Member Avatar for nezumi4

So what's the problem, other than not using CODE tags as requested in the Rules. Maybe you need to read [url=http://www.daniweb.com/techtalkforums/thread78223.html][b]Read Me:[/b] Read This Before Posting[/url] too.

Member Avatar for Lerner
0
101
Member Avatar for linux0id

The string with the %x symbols in it are parsed to find each symbol. The letter is then looked at to figure out what field is supposed to go there. Then the string is changed by removing the %x and whatever field is requested replaces it. Usually the data comes …

Member Avatar for linux0id
0
13K
Member Avatar for nurulshidanoni

[QUOTE=nurulshidanoni;533835]How to arrange the number properly?[/QUOTE] One digit after another. If there is a portion that's below 1, add a '.' and that portion. If negative, '-' in front of all the digits.

Member Avatar for WaltP
0
113
Member Avatar for newport

It would help if you'd [url=http://www.gidnetwork.com/b-38.html]format your code[/url] so we can follow it's flow. Proper indentation is crucial to understanding.

Member Avatar for Narue
0
173
Member Avatar for vishalkhialani

Read [url=http://www.gidnetwork.com/b-38.html]this[/url] and [url=http://www.gidnetwork.com/b-66.html]this[/url], please. They will help you in the long run.

Member Avatar for vishalkhialani
0
469
Member Avatar for jimJohnson

[QUOTE=niek_e;533117]When you have all the input, just check if one of them is smaller then 0 and print a error message:[/QUOTE] Or better yet, wrap each input in a [ICODE]while[/ICODE] loop that tests for <0: [code=c] inp = -1; // force the value to be < 0 while (inp < …

Member Avatar for jimJohnson
0
150
Member Avatar for nurulshidanoni

[QUOTE=nurulshidanoni;533900]How to correct the output, because for the bold it follows every studentid.[/QUOTE] Why do you insist on not giving us the information we need to understand what you want? When was the last time you read the post [url=http://www.daniweb.com/techtalkforums/thread78223.html][b]Read Me:[/b] Read This Before Posting[/url]? Start explaining in detail what …

Member Avatar for WaltP
0
96
Member Avatar for wolverine_ramir

[QUOTE=jephthah;532813][QUOTE=ithelp;532808]I guess you meant stdio.h .[/QUOTE] oops, yeah. thanks and i also meant to put the last "printf" statement *AFTER* the close of the while() block. :P[/QUOTE] This is why we recommend you [I]test[/I] code you post. It generally doesn't help the poster if you give bad advice --- they …

Member Avatar for John A
0
152
Member Avatar for nickthedivil

[QUOTE=nickthedivil;533724]I promise never ever ever to use gets() again[/QUOTE] Why? are you just going to believe him with no understanding of why he claims it's bad? :?:

Member Avatar for WaltP
0
101
Member Avatar for Exo1337

If you are converting [B]cm[/B] to [B]yd,ft,in[/B], first thing to do is convert your centimeters into inches. All this can be done with integers, you'll only be off by about 1/2 inch as long as you round properly.. Then, using the division you can get the number of yards. The …

Member Avatar for WaltP
0
721
Member Avatar for VersEtreOuNe

Only output the record if [I]client.GetAccountNumber() [/I] is the account number entered. Similar to your output [icode]while[/icode] loop.

Member Avatar for WaltP
0
142
Member Avatar for SteveDee

Please ignore all those bozos above. The reason your loop becomes infinite is the '.' is not valid for an integer, therefore 1) [ICODE]cin[/ICODE] reads the number up to the '.' and stops. The '.' is left in the input buffer 2) the next [ICODE]cin[/ICODE] tries to read the '.' …

Member Avatar for WaltP
0
261

The End.