1,265 Posted Topics

Member Avatar for tquiva

the reason is because your different functions individually parse each character without regard to what the other is doing. Specifically, your "SkipOverRestOfCommand" function disposes of the ';' character without properly accounting for it to the "SkipBlanks" function. in the even someone enters a ';' before any commands, your "SkipBlanks" function …

Member Avatar for jephthah
0
213
Member Avatar for luvmusic202006

you're trying to use a 20-year-old compiler on a modern OS. that's the problem. Turbo C sucks enough already, but is known to be especially more problematic when installed on Windows Vista. there are some workarounds but I'm not going to advocate them. [URL="http://www.codeblocks.org/"]The real solution[/URL] starts when you uninstall …

Member Avatar for jephthah
0
77
Member Avatar for ammarZ

this so totally does [B]not[/B] belong as a code snippet. code snippets are supposed to be working code, that solves a particular problem, and that isl also be likely to be useful to at least a few other people in the world, somewhere. but this ... this is a cry …

Member Avatar for jephthah
0
115
Member Avatar for rgpii

this is the reason why globals are generally considered bad programming. unless you have a compelling reason to do so, do not use global variables. pass your array as a pointer argument into the functions that will be making use of it and/or modifying it. your problems will disappear.

Member Avatar for WaltP
0
1K
Member Avatar for newbiecoder

scanf is often the source of input problems. as you can see, you have the most trivial example and it's [I]already[/I] being problematic. since there are better alternatives readily available, you'll do well to learn to stop using it as soon as possible. i too am partial to [URL="http://www.cplusplus.com/reference/clibrary/cstdio/fgets/"]fgets()[/URL]. it's …

Member Avatar for newbiecoder
0
257
Member Avatar for dondajr

header files are good programming practice especially for large projects with mulitple files. but, no, you can't just plop a header file into some other program and have it work without code available. you do need to have the source code -- in one form or another -- included as …

Member Avatar for jephthah
0
152
Member Avatar for nilessss

Do you need to learn how to program in C? there are plenty of tutorials. Here's one: [URL="http://www.cprogramming.com/tutorial.html#ctutorial"]Basics of C Programming[/URL] Do you want to write [I]better [/I]C? there are plenty of guides. Here's one: [URL="http://www.ibm.com/developerworks/linux/library/l-clear-code"]Six ways to write more comprehensible code[/URL] .

Member Avatar for jephthah
0
94
Member Avatar for DoEds

(1) use [URL="http://www.cplusplus.com/reference/clibrary/cstdio/fopen/"]fopen()[/URL] to [B]read [/B]all items from the file into a structure in memory, then [URL="http://www.cplusplus.com/reference/clibrary/cstdio/fclose/"]fclose()[/URL] the file immediately (2) do whatever manipulations you want on the memory structure. (3) when the user is ready to commit a change (either singly or in a batch) reopen the file using …

Member Avatar for Adak
0
1K
Member Avatar for nastia

i've never heard of Relo as an IDE, so I don't know anything about it. If you're using it with the MinGW compiler, I suppose it should be fine. open up a new project and either write or copy and paste your C code. if it's anything like any other …

Member Avatar for nastia
0
97
Member Avatar for Aby_G

basically the "inner loop" is variable, and will execute a number of times that varies depending on the value of the outer loops. outer loop #1 inner loop executes 1 time outer loop #2 inner loop executes 2 times outer loop #3 inner loop executes 3 times etc. consider also, …

Member Avatar for sganesh
0
166
Member Avatar for mattitude

it's [B]totally [/B]due to that terrible hack of a "wait" routine. that's it and that's all. the while loop is using [I]every single available CPU cycle[/I] to approximate a timer. Like AD said, you need to use the library function for sleep(), in order to free up the CPU for …

Member Avatar for jephthah
0
114
Member Avatar for kng

you probably want to look into [URL="http://www.google.com/search?q=sparse+matrix+compression"]sparse matrix compression[/URL] algorithms

Member Avatar for abhimanipal
0
146
Member Avatar for Interesting_Hat

[code=text] [pseudocode] initialize sumOfCubes = 0.0 for a = 1 to 3 { get float input from user store in inputValue initialize cubedValue = 1.0 for b = 1 to 3 { cubedValue = cubedValue * inputValue } print "the cube of " inputValue " is " cubedValue "." sumOfCubes …

Member Avatar for stratsp
0
135
Member Avatar for tinkerkyala

hi friends i m a comptr eeng. student ı saw your codes then ı felt bad because ı think ı should improve my codes ?so how can improve my codes?ı m 2.class student..thxx don't hijack someone else's thread to feel bad in. formulate a specific, coherent question and go post …

Member Avatar for abhimanipal
0
126
Member Avatar for DoEds

Funny thing, Walt, i've noticed your own recent posts where you do exactly the same thing. such as this one here, where your only response to some guy's crap code was to tell him that it's full of problems and he needs to refrain from posting. [QUOTE=WaltP;1151442]Please ignore yila's code. …

Member Avatar for DoEds
1
278
Member Avatar for hamilton168

the recursive stack is because they're trying to teach you a concept, not just so you can 'get it done' you definitely should do it the way that's required even if another way seems easier. i was going to look at this myself, but i'm at work and don't have …

Member Avatar for Adak
0
200
Member Avatar for alfroad
Member Avatar for alfroad

[QUOTE=alfroad;1155892]hello guys can you give me... [/quote] now that the thread has been moved, the lesson is : DON'T hijack someone else's thread with some completely unrelated question of your own. but please DO rephrase your question in a coherent manner so the rest of us might understand what you're …

Member Avatar for abhimanipal
0
86
Member Avatar for Soileau

[b]crappy[/b] (krap' e) - [I]adjective[/I], slang. (1) difficult to implement without requiring an excessive amount of overhead to prevent it from falling apart during normal field use. (2) anything that exists alongside a freely available alternative from the standard library that covers most use scenarios in a manner resistant to …

Member Avatar for Dave Sinkula
0
4K
Member Avatar for jose385

wait, wait... your code prints a full pyramid. [code=text]3= * *** *****[/code] which is way more complicated than printing a half pyramid. [code=text]3= * ** ***[/code] man, how did you figure out a full pyramid but not be able to get the much simpler half pyramid? read what walt said. …

Member Avatar for jephthah
0
302
Member Avatar for iliali16

[QUOTE=iliali16;1147699]tutorials in C and I seem to grasp some of the ideas of the language but as I learned it is a very messy language.[/quote] C is a very well-defined and highly structured language, probably one of the most structured languages you'll find. there's nothing messy about it. Perhaps your …

Member Avatar for jephthah
0
289
Member Avatar for donelliewhyte

here's a hint. you can use the function strstr, in a manner similar to this: [CODE]result_ptr = strstr(registrationString,":") printf("the registration number is %s\n",(result_ptr + 1));[/CODE] EDIT: I just noticed your other thread. People here (including me) are very cautious about people coming here wanting work done for them. I dont …

Member Avatar for jephthah
0
78
Member Avatar for uday.rnsit

[QUOTE]Pls can u guide me hw cud i b a good programmer?[/QUOTE] ... sent from uday's Blackberry Wireless.

Member Avatar for jephthah
-2
124
Member Avatar for milind123
Member Avatar for dumbncool

n is XOR'ed with an unsigned -1, the resulting value is stored in 'n' -1 is treated as an unsigned integer, meaning just that it's a variable with all bits are ones. a 32-bit int, will be 0xFFFFFFFF basically this is like a microcontroller register operation that "flips" all the …

Member Avatar for jephthah
0
124
Member Avatar for ROBIN8719

was the C program compiled on Vista, or did you grab an already-compiled .EXE from somewhere else? you need to have compiled the executable on Vista. so yes, you'll need a C-compiler. MS provides a basic, free version of Visual C/C++

Member Avatar for peter_budo
0
138
Member Avatar for somename

i would like to make an observation. obscure variable names, cryptic logic, and peculiar bracket indentations do not lend your code to being easily read by the casual passer-by who might be inclined to scan your code for obvious or hidden errors. this might also explain why for what's otherwise …

Member Avatar for somename
0
135
Member Avatar for gerard4143

i shall post in here now, so i can remember to visit it later, when i am "leisurely bored" :)

Member Avatar for gerard4143
0
136
Member Avatar for funtoknow

i tend to avoid "do/while" loops. "do" statements are kind of unpopular with most c programmers unless theres a compelling reason to use them. just use a while statement to get the same effect. as for validating floats... stay away from scanf. I would personally input a string, validate that …

Member Avatar for pebbles
0
393
Member Avatar for dkmmd2002

hello. generally this is just a hey whassup shout out to the new folks. specific questions would be more likely to get a response, if posted in the forums. but welcome. stick around and contribute your questions or answers, whichever you have more of! :)

Member Avatar for jephthah
0
111
Member Avatar for hwlibra083

so what's your question? and what have you done so far? go ahead and show us what you've got. here's a handy template: [code] #include <stdio.h> #include <stdlib.h> int main(void) { // paste code here return 0; } [/code] oh, wait? you want hints on how to start? okay, here …

Member Avatar for hwlibra083
0
1K
Member Avatar for johndoe444

well... your question is kind of hard to follow but, i think your confusion might be in your while() statement. for instance: if [iCODE]k=1[/iCODE], and then you say [iCODE]while (k-- > 0)[/iCODE] the statement [iCODE]k-- > 0[/iCODE] is true, because k post-decremented is evaluated while [iCODE]k=1[/iCODE] but then the post …

Member Avatar for WaltP
0
2K
Member Avatar for COKEDUDE

[QUOTE=COKEDUDE;1132853]When you have a function and need to scan for 2 different numbers, should the scanf be in the function or in the main() and why?[/QUOTE] question is flawed. you shouldnt use scanf for user input. use [url="http://www.cplusplus.com/reference/clibrary/cstdio/fgets/"]fgets()[/url] in conjunction with [URL="http://www.cplusplus.com/reference/clibrary/cstdio/sscanf/"]sscanf()[/URL] or [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/atol/"]atol()[/URL] or [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/atof/"]atof()[/URL] or something similar. see …

Member Avatar for WaltP
0
153
Member Avatar for COKEDUDE

[QUOTE=gerard4143;1133000]It was written/run once and appeared to work...that's quickly in my books.[/QUOTE] what constitutes "appearing to work" for you? not having the computer crash? if so, then yeah, it "appeared to work". other than that, it was full of compiler warnings and gives nonsensical output. Boo.

Member Avatar for gerard4143
0
112
Member Avatar for COKEDUDE

scanf is a notoriously difficult function to use, especially for beginners. try using fgets in conjunction with atoi instead. [CODE]char strInput[MAX_LEN_INPUT]; int value; fgets(strInput, MAX_LEN_INPUT-1, stdin); value = atoi(strInput);[/CODE] once you figure out this basic method, use strtol instead of atoi, and you can make a pretty bulletproof input routine …

Member Avatar for WaltP
0
200
Member Avatar for techno_weenie

[QUOTE]Well, this was probably a bad idea,[/QUOTE] yeah.... it's unfair to the newbie poster to be handed such a lovingly polished solution, and it's unfair to the rest of us here who strive to teach students how to do their own work without handing it to them. it'd be one …

Member Avatar for IsharaComix
0
133
Member Avatar for tikoti

[QUOTE=tikoti;1131607]OMG It was a stupide question Thank you for answering! ;)[/QUOTE] i recall some recent snafu at NASA causing a significant failure, and being traced to a divide-by-zero error. (or, maybe i dreamed it. i'm not sure now...) but anyhow it's not a stupid question. it's a good lesson. For …

Member Avatar for jephthah
0
474
Member Avatar for techno_weenie

[QUOTE=techno_weenie;1132758]Hello, I'm trying to split a string into 4 separate strings using a delimiter "\n" [/QUOTE] i would suggest that replacing printable characters with '\n' as a delimiter is a Bad Idea. Because what is '\n', anyhow? is it 0x0D ? is it 0x0A ? or is it 0x0D + …

Member Avatar for jephthah
0
144
Member Avatar for newcuser

swap the product and seller indices [code=text] [pseudo] print columnheaders, newline for p = 1 to NUMPRODS print "product #", p for s = 1 to NUMSELLERS print matrix[s-1][p-1] next s print newline next p done [/pseudo] [/code] .

Member Avatar for jephthah
0
76
Member Avatar for taggz19

if you want to [b]round[/b] the number, then you use "setprecision(<n>)" or the format specifier "%.<n>f" for "printf()" where <n> is the number of digits you want to round to. E.g., the value 1.66667 rounded to <n>=1 decimal place will be 1.7 but what you really want to do here …

Member Avatar for peter_budo
0
402
Member Avatar for priyarrb

once you address what walt said, your first code problem i see is <conio.h> remove that line, and remove everything that depends on it. then rewrite in standard C. until you do that, i doubt anyone here will bother trying to compile and run your code, because no one uses …

Member Avatar for abhimanipal
-1
144
Member Avatar for swathydoss

[quote=swathydoss;1117778]hi....... I want a program in c based on any data structures with de code.plz............it shd be catchy n can be based on reality[/quote] omfg U R 2 cool! wer R U @ a/s/l? Did U gt de CODEZ? snd dem 2 me PLZ! zomgWTFbbq!!!1 lololol .

Member Avatar for jephthah
-4
90
Member Avatar for phoenix69

Heres their program's header file [code=c]/** * StopDice.h * Defines constants used for StopDice program logic and graphics * * NOTE that string constants are NOT declared constants in order * to conform to the requirements of WinBGIm functions that do * not define constant string parameters when they should. …

Member Avatar for peter_budo
0
1K
Member Avatar for sailee
Member Avatar for Davo1977

you posted this question twice dave. does your program not work? what is your question?

Member Avatar for d5e5
-1
243
Member Avatar for Dani

i think your changes are inspired by a lot of good ideas :) but like some other i also think it has added the perception of too much clutter. i think the most grievous offender is the row of "share this" "send that" "bookmark" "yadda yadda" buttons... I think they're …

Member Avatar for feoperro
3
941
Member Avatar for xavier666

here's a bug: [icode]#include <conio.h>[/icode] your program is worthless with that in it. why do you people insist on clinging onto that Turbo C crap?

Member Avatar for binkiwinki
-3
375
Member Avatar for cwarn23

i thought the Big Bang was actually the Egyptian god, Ptah,who masturbated and his ejaculate became the universe.

Member Avatar for Dope 7560
0
318
Member Avatar for fenerista

^ that may work for you in this instance, but it's not standard C, and will not be portable. thats a realtime clock library that is often found on linux machines, but is not guaranteed by the C standard. for standard C that will work everywhere, use the functions "time()", …

Member Avatar for fenerista
0
496
Member Avatar for joperalez

[QUOTE=joperalez;1078095]I know this is using C. But if i was using the stdlib.h to use C in C++ ..... trying to find a simple way to add two hex numbers together but in C++;[/QUOTE] I know this is the C forum, but if it were the C++ forum, it would …

Member Avatar for Nick Evan
0
124

The End.