949 Posted Topics

Member Avatar for varun mca

It could be just as simple as: [CODE] for(i=0;i<LinesOnYourScreen;i++) putchar('\n'); [/CODE] There is no magic command to clear a screen that I know of. You can either write out a space (that is, a blank space with the current background color), or you can output newlines. You should use unbuffered …

Member Avatar for Adak
0
118
Member Avatar for bflack
Member Avatar for N1GHTS
Member Avatar for tomtetlaw

The shift key shows no output, by itself, so it has no ASCII code value. If the shift key is depressed, the OTHER keys will have a different ASCII value, but the shift key itself, doesn't need one. There is a "shift in" and "shift out" at ASCII 14 and …

Member Avatar for Ancient Dragon
0
198
Member Avatar for tomtetlaw

Not to interrupt your focus on strtok, but you could "roll your own" on such a simple task, in half the time, and half the trouble. start at the first char of the string in a loop, "walk" through the string, until you find a comma, assigning a small char …

Member Avatar for Narue
0
173
Member Avatar for tomtetlaw

Now I think I see what you're question is: Try running this: [CODE] #include <stdio.h> #include <string.h> int main() { int i, unique; char str[]="developer,developer0,developer"; char *pstr; printf("\n\n original string: %s \n", str); pstr = strtok(str, ","); printf("\n pointer: %s \n", pstr); printf("\n string[]: %s \n", str); while(1) { pstr …

Member Avatar for tomtetlaw
0
87
Member Avatar for varun mca

I'd be tempted to use a small 2D word array: [CODE] powr[] array: [0]="teen" [1]="ty" [2]="hundred" [3]="thousand" etc. wrd[] array: 0="zero" 1="one" 2="two" etc. [/CODE] and this might easily change. I'm not familiar with this exercise. and put together the string answer, from big to small number values: ans[100]={""}; and …

Member Avatar for varun mca
0
93
Member Avatar for litsluv

Why put a pair of code tag around your code? It's very difficult to study code in detail, if it's squished over like html text. I couldn't fix your program - it's pretty sloppy (like having comma's at the end of a line of code, instead of a semi-colon), and …

Member Avatar for Adak
0
209
Member Avatar for king chandel

Yes, but only in a very limited way. You can use text functions in the console window. You can go into graphics mode, with the limited drivers that TC had, from back in the DOS days. Those still work. I use TC for small text window programs - little puzzles …

Member Avatar for Adak
0
139
Member Avatar for DocRocks

The trick is to keep in mind that C always passes parameters to functions by copy - the description "by value" or "by reference", is just an effect of copying either a value (like a variable), or an address (like a &value or array). And remember that local variables from …

Member Avatar for Adak
0
123
Member Avatar for WHITE_BOLT

We're not a "do the program for you", forum. We help people with THEIR programs, if we can. If you really have no code or pseudo code, at all, check out Google for homework sites, and see if you can find a "do it for you", forum. Maybe hire a …

Member Avatar for Adak
0
119
Member Avatar for iwanttolearnc

Remove the first ++ from howlong++. getch() returns it's value to the left hand side (the Lvalue), of the equation: [CODE]char1 = getch(); if(char1== 'p') break;[/CODE] Would be how I'd do it. But there's another problem which is always present when scanf() is involved (potentially), and that is clearing out …

Member Avatar for iwanttolearnc
0
114
Member Avatar for JMoh

Pretty much the same way you find your shoes in the morning: 1) scan the floor, find the left shoe 2) scan some more floor, find the right shoe. Check if the strings are the same, about the same way you see if your shoes are a matching pair: 1) …

Member Avatar for Adak
0
166
Member Avatar for arnas

Two things: 1) If your compiler is Turbo C, you won't load the floating point package you need, with that code. You need to have at least one of the doubles assigned an initial value of 0.0. (since TC's float package can be stubborn about this, post back if you're …

Member Avatar for arnas
0
233
Member Avatar for jemz

To find the center column for the first *, you can use either the number of rows in the "tree", or the number of *s, in the bottom row. So if the bottom row has 7 *s, then 7/2 equals 3. So you should have 3 spaces before the * …

Member Avatar for jemz
0
73
Member Avatar for myk45

Think of an old fashioned car odometer, with three wheels displaying their digit. Now use three nested for loops, and don't over-complicate it. Let the loops do their magic. No if's, no else's, no bs. Easy as pie. ;) [CODE] int w1, w2, w3; //wheel 1, wheel 2, wheel 3 …

Member Avatar for myk45
0
80
Member Avatar for sujathaarsid

The number of iterations needed to sort, will vary considerably depending on the number of items there are to sort, as well as the algorithm you choose. Even a non-comparison sorting algorithm like Counting Sort, will have to iterate through once, for each item to be sorted. It's very instructive …

Member Avatar for Adak
0
90
Member Avatar for rapids79

Why aren't you including math.h? Looks like an overflow problem, at first glance.

Member Avatar for rapids79
0
135
Member Avatar for itsmeisuru

OK. First, open the number file, then open the number and name file. Here, use fgets(), to put the whole row at a time, into a char buffer array. Include string.h to allow: len=strlen(buff), after you've fgets() a row of text from the name and number file. Then your buffer …

Member Avatar for N1GHTS
0
108
Member Avatar for furqankhyraj

This isn't a project idea forum, but there is a lot of material on the web on this topic. Google my friend, the sooner the better.

Member Avatar for creeps
0
104
Member Avatar for GHETTO COWBOY

I would suggest if(row < 1) and if(col < 1), rather than < 0. Our arrays start with zero, but that is the first row, so the array has to have at least 1 row, and 1 column, also. Think about that data entry loop. If I say I want …

Member Avatar for Adak
0
114
Member Avatar for challarao

A very simple function. Here's a sample program: [CODE] #include <stdio.h> #include <string.h> int main() { int i, j, temp; char s[]="Once a jolly swagman"; i=0; j=strlen(s) - 1; while(i < j) { temp = s[i]; s[i++] = s[j]; s[j--] = temp; } printf("\n\n New string is: %s", s); printf("\n\n\t\t\t …

Member Avatar for sree_ec
1
4K
Member Avatar for reliableravi

Welcome to the forum, Reliableravi. ;) Post up a line of text that you typically want the program to find, and then show (and hopefully tell us), what you want done with the output of the program. And I KNOW you will post up your attempt to program this in …

Member Avatar for abhimanipal
0
251
Member Avatar for nigelmercier

Creeps got your back, Nigel. while(variable > 0), peel those bad digits right on off.

Member Avatar for nigelmercier
0
214
Member Avatar for creeps

Have you tried testing the return from sscanf() ? When it return anything less than 1, you should be at the end of the file - or at least something stopped sscanf() from working right. It is frustrating how you have to "dance around" to do such a simple thing.

Member Avatar for Narue
0
158
Member Avatar for SaiBalaji

I have a better idea: You read the Wikipedia article on Sieve of Eratosthenes, and get started on implementing that algorithm, into your program. Then you post it, when and if you get stuck or have questions - and we will strive to help out. Because we're not a homework …

Member Avatar for Nick Evan
-1
103
Member Avatar for priyanka.js28

Depends on how smart the compiler is. A modern compiler should be able to deduce that the compiled code needed, is the same.

Member Avatar for SaiBalaji
0
427
Member Avatar for Kevin_160

No, you can't get access to the cpu clock, or run DOS on a Windows XP or above. The Windows kernel was changed with Windows2000 to the NT version. Now, DOS programs can run only in a virtual window of some kind. NTDVM.exe is the one I see in WindowsXP …

Member Avatar for Kevin_160
0
250
Member Avatar for guru_iyer

You're trying to malloc() memory, but haven't included the required stdlib.h file. Normally, you'd get an error message, but since you're also casting the results of malloc() in your program, that error is not sent. Malloc returns a void pointer, so there are very few times that you need to …

Member Avatar for Adak
0
3K
Member Avatar for capsicum

static variables are initialized just once, on the first call to the function. There was a need for a static variable that would be encapsulated (could be used) by a certain function, and no others. If you have a particular question about your program's storage classes, post up the code, …

Member Avatar for Adak
0
284
Member Avatar for boiishuvo

Whether you use 3 linked lists, 3 small arrays, or 3 small LIFO stacks (I refer to FIFO structs as queues), just remember that if you want to move an odd number of disks to needle #1, then you start by moving the first disk TO needle #1. When you …

Member Avatar for Adak
0
4K
Member Avatar for ankur3000

Why the one char strings in refs[], instead of just single char's? Looks quite odd.

Member Avatar for Auraomega
0
125
Member Avatar for baby_c

Looks like your compiler is telling your to use unsigned long int. Try that, one time. *Always pay attention closely to any compiler error or warnings!* Learning to debug is an important part of programming, and using compiler messages is a critical part of that.

Member Avatar for sree_ec
0
956
Member Avatar for Clawsy

I just tried this for fun in Turbo C, using an array of char pointers: [CODE]char *names[SIZE];[/CODE] then getting the length of each name, and malloc'ing the memory for it, and putting it into the names[i++] position. Using short names, TC was limited to less than 5k names (4,200 average). …

Member Avatar for Adak
0
151
Member Avatar for sankhamita

You want to use a static char array or a dynamic array of char pointers? What do you think, maybe 50 rows, 80 char's each should be enough?

Member Avatar for Adak
0
84
Member Avatar for saminder singh

Remember the number line for bianry: [CODE]2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0[/CODE] And our number line works the exact same way, just substitute a 10 for the left 2's, above (left hand side only in the case of 2^2, of course). So that indicates that we can, in …

Member Avatar for Adak
-2
195
Member Avatar for SaiBalaji

Basically, they're like shit - they happen. ;) You can roughly divide them up as compiler errors, compiler warnings, linker errors, logic errors, and run time errors. Each one you could write a good deal about. For more info, Google each of the above, and check out some C tutorials …

Member Avatar for Ancient Dragon
0
105
Member Avatar for firoz3321

You might look at it as an array of integers. Each digit in the number, then is assigned to an element of the array: 456 becomes a[4][5][6] in it's first three elements, or, a[0] = 4, a[1] = 5, and a[2] = 6. You can do about the same thing, …

Member Avatar for prvnkmr449
0
4K
Member Avatar for vskumar19

What about using a binary search pattern on the addresses of the shorter link? (same size links, then choose either one). If at a given node the addresses are == then lo moves up to current position + 1. Next comparison would be 1/2 that far up the link. If …

Member Avatar for vskumar19
0
111
Member Avatar for amit kithana

Turbo C is a 16 bit based product. To run it in Windows 7, you need a 16 bit (DOS sized), environment. The easiest way to do this (afaik), is to use a program like DOSBOX or VMWare. Either one (get the right product from VMWare, as they have several), …

Member Avatar for sree_ec
-1
162
Member Avatar for arshiyafatima

If it involves C++ code or assignment, then you should post this request for help in the C++ forum, of course. If it's for C code, you'll have to tell us about your project. What's the input, the computations you need to make, and the output? Any other requirements, like …

Member Avatar for markiss_salado
-1
215
Member Avatar for Mouche

C has functions to print up, or help you print up dates, in a variety of formats. So free the memory, afterward. As long as you have the right address, what function you free the memory in, won't matter to the OS. There's no need for the cast you have …

Member Avatar for Mouche
0
612
Member Avatar for sankhamita

As soon as you can manage it, move away from the scanf() and fscanf() functions. They are not robust, and will quit for the smallest variance, sometimes. the answer is to use: [CODE]fgets(stringBuffer, sizeof(stringBuffer), stdin (or filePointer) );[/CODE] It works remarkably well, the file or the user can NOT over-flow …

Member Avatar for Adak
0
118
Member Avatar for viji.cs

Using strtoi() or atoi(), comes to mind (include stdlib.h). If the 3D part of it has your head stretched out sideways, post a very small example showing your problem, and what you want out of the data, for an example.

Member Avatar for Adak
0
191
Member Avatar for Babaty

OK, I've checked it out - big assignment! You better get started, eh? ;) Post back when you have a question about your C program.

Member Avatar for prvnkmr449
-3
117
Member Avatar for atomic33
Member Avatar for malvi

Study your manual that came with the micro controller. What you can do depends on the system set up, and what compiler is made to run on it, etc.

Member Avatar for Adak
0
254
Member Avatar for paula_m

You need: 1) To put code tags around all your code, for the forum. Otherwise your code is very hard to study. Highlight it, and click on the CODE icon in the editing window. 2) Show an example of the input - just two or thee lines is enough 3) …

Member Avatar for samkaraja
0
214
Member Avatar for lonely_girl
Re: HELP

Where *could* that program be? 1: Left of here? Naw, nothing interesting there. 2: Right of here? Nope, just the right margin of the window 3: Down from here? Nope. Only newer posts are there, and you're looking for an older post. So where could that program be? For the …

Member Avatar for Adak
0
257
Member Avatar for baby_c

If you have some code, and a question about that code, I'm happy to try and help. In this case, you need, it seems to me, a tutorial. There are many excellent tutorials on the Web, both text based and video - some even from major universities. Hiyaki over that …

Member Avatar for Adak
0
113

The End.