Posts
 
Reputation
Joined
Last Seen
Ranked #107
Strength to Increase Rep
+14
Strength to Decrease Rep
-3
85% Quality Score
Upvotes Received
206
Posts with Upvotes
176
Upvoting Members
109
Downvotes Received
36
Posts with Downvotes
33
Downvoting Members
23
73 Commented Posts

949 Posted Topics

Member Avatar for mikeandike22

You're looking at the same problem, from WAY different perspectives. Narue has a lot of experience, at a high level, with languages, while VEGETA-DTX has very little experience, but STILL has a valid point to make. As the old quip says: (and I roughly paraphrase) "The great achievements of man …

Member Avatar for VEGETA_DTX
1
2K
Member Avatar for vvsmario

Line 17 puts the needed end of string marker char, into place. Remember, chars are just a bunch of chars, UNTIL they have an end of string marker in place, after them. bunch of chars: just a bunch of chars. now a string: just one string.'\0' It's confusing, because the …

Member Avatar for Busuioc
-1
4K
Member Avatar for pvbhargav
Member Avatar for Hi-Tone

You've got a pointer to a pointer - and you've set aside no memory for it, at all. The algorithm may be OK, but it's not one I'd recommend you use. Strive for clarity and simplicity in your code. adding two matrices into a third matrix which is NOT a …

Member Avatar for Akbar_5
0
3K
Member Avatar for nivedita5

First, be aware that your code is C++, and you are compiling it (obviously) with a C++ compiler, instead of the C compiler. This answer works in C, but you may need to adapt it to work with C++. Sachi's code is also C, since this is the C forum. …

Member Avatar for 2teez
0
3K
Member Avatar for Louie_Rave

A "void" is an empty area - like "space is mostly a huge void". It also means "amounting to nothing" as in "the lawsuit was made null and void". So a void function is any function that returns nothing. It may say "return" at the end of it, but it …

Member Avatar for markanderson4
1
4K
Member Avatar for tyrantbrian
Member Avatar for rizrash

Turbo C has it's quirks, but here's some hints I use (and I use Turbo C/C++ (the C compiler portion), very often. 1) Use Turbo C/C++, NOT "Turbo C". Turbo C was an earlier product, and is buggy. Turbo C/C++ is fine - I recommend ver. 2.0, but 1.01 is …

Member Avatar for David W
0
675
Member Avatar for keval_hack

[QUOTE=keval_hack;1638142][I]Interesting tricky program using C & C++: [/I] [B]Program 1:[/B] Create a Program which produce output "Hello World" , the program must not contains semicolon ; in other word any statement of the program will not have a termination semicolon. [B]Program 2:[/B] Write a C or C++ program which run …

Member Avatar for Ahamed_1
-1
2K
Member Avatar for sureshshan1292

sureshshan1292, in the spiral problem, you should be hearing warning sirens that your algorithm is too (low-level in the logic, explicit, or specific), and not abstracted enough. That is a LOT of code! Are you still interested in this problem, or did you figure out what you wanted, already?

Member Avatar for ekambaram
2
3K
Member Avatar for jephthah

It's good. ;) The one I like moves the stream pointer for the keyboard - very elegant, but everybody asks WTF is THAT?

Member Avatar for David_50
0
6K
Member Avatar for binaryjc

Perhaps you are using the angle of 45 you have defined, instead of calculating the real angle on the bounce off the bricks, or the wall. If you Google for that equation, you'll find it easily. I don't have it on this system, but it's simple geometry.

Member Avatar for pr@j@kt@
0
2K
Member Avatar for Anil2447

The bubble sort doesn't "bubble". ;) Bubble sort compares only adjacent values in an array. What you have labeled Bubble sort, is actually Substitution sort, which is in the same class, but compares non-adjacent array values, 95% of the time (or so). Also, Bubble sort usually has (and always should …

Member Avatar for Talha_5
0
9K
Member Avatar for cse.avinash

You need the program to find up to 1 million prime numbers, in 5 seconds? That's a job for ya! ;) I just tried out my trusty prime number finder, and it took it 5.8 seconds with a pretty fast i7 cpu system (3.5GHz). To go from 10 seconds to …

Member Avatar for vantrendin
1
6K
Member Avatar for Vandithar

I believe you can run Turbo C in Windows 7, but it has to run inside a virtual machine. This is how it ran in WindowsXP as well, using the NT VDM. I haven't done this yet, but surely will some time soon. Google it, and also check out DOS …

Member Avatar for maha harshini
0
407
Member Avatar for ricciola

Welcome to the forum, Akshay1. This thread is 3 years old - how about starting a new one? More specifics of your assignment, would help. Also, what is stopping you from including string.h and using strstr() to find your string in the text file.?

Member Avatar for shentong
0
3K
Member Avatar for mixmagz

I applaud your energy, but you don't understand what programming is all about. The rare goto is OK, but there's no need for them in TTT. C (and all programming languages to some extent), are meant to be a concise and efficient way to do something. Where accuracy is paramount, …

Member Avatar for mkamrul
0
1K
Member Avatar for Josue198s

If you're having problems with a do loop, you need to post up code that includes the do loop. ;) Using CODE TAGS! <of course> Putting your code right between code tags, lets your code stay looking like code, and not like a dog's breakfast.

Member Avatar for rajii93
0
225
Member Avatar for pittdaniweb
Member Avatar for nakul_pancholi

Hi Nakul, Try to learn C the right way: 1) It's always int main(), never just main() or void main(), and it always has a return integer (generally always 0). 2) now let's make your program look like a *program* on the forum: Just click on the [.code] icon, in …

Member Avatar for arulgee6
0
1K
Member Avatar for shakin

One concern I have with your code is that x doesn't appear to be reset, so the while loops working with it, are going to go bust. I don't believe you understood the wisdom of deceptikon's post, right above yours. Your code looks positively PAINFUL. You don't need to work …

Member Avatar for N1GHTS
0
260
Member Avatar for Neelam_1

If you know that all global variables, with no storage class mentioned, are 1) kept until the end of the program. and 2) available to your program in any function, without using a parameter. and 3) may be overshadowed or covered, by a local variable with the same name, in …

Member Avatar for Neelam_1
0
206
Member Avatar for Thundermax

size_t j = pon - string1[0]; is the index to the first char of string2, within string1.

Member Avatar for Ancient Dragon
0
156
Member Avatar for nitin1

I like #1 or #3. #1 because it uses bit shifting, which is always fast. The only minus is the subtraction. I like #3 because it allows full optimization by the compiler - which surely is set up for something as common as multiplication, in unbeatable time. The #2 I …

Member Avatar for rubberman
0
261
Member Avatar for Raymond Albert

You need to add curly braces { } whenever you have an expression with multiple lines of sub expressions, or it won't work as you want it to. if(some test is true { first code expression; second code expression; } Without the braces being in the above, ONLY the first …

Member Avatar for Adak
0
4K
Member Avatar for toniann.midori

If you want your calculations to be accurate at all, you need to use doubles or floats. Integer division is especially (spectacularly) diabolical. And "millage"? Really?

Member Avatar for toniann.midori
0
357
Member Avatar for logicslab

I really like Pelles C for Windows. It's NOT C++, but it has an extensive help section, full IDE editor, debugger, profiler, and it's own forum for learning the in's and out's of using it. There is a learning curve for using it, because it is a Windows program. I …

Member Avatar for deceptikon
0
394
Member Avatar for nitin1

Use the PDCurses library for all the console control you could ever want.

Member Avatar for deceptikon
0
1K
Member Avatar for aVar++

Syria has a great need for humanitarian help - US and it's Allies can assist there, (and is) in Jordan. The civil war in Syria will have to be sorted out by the Syrians (plus any other fighters from Islamic countries that will participate). It will be a huge war, …

Member Avatar for HiHe
3
2K
Member Avatar for Thundermax

You need to remove the newline char that fgets() always adds to the end of the string it receives. Nice actually looks like this, when it's the last word in the string: "nice\n\0". And what you are searching for is "nice\0". So a bit of code for inside the for …

Member Avatar for Adak
0
215
Member Avatar for karma2you

Line 53, remove the semi-colon from the end of that line. Remove lines 61 and 62. Line 94, put a space before the % in the scanf-- scanf(" %c", &entered_char); Line 96, you need to surround both logical arguments in your if statement, with parentheseis: if((argument1) || (argument2)) Line 102, …

Member Avatar for Adak
0
829
Member Avatar for Thundermax

No there isn't. There is one to search for a string within a larger string, however. The general logic would be: #include <string.h> use strstr() to locate the word you want to replace. Save the position (pointer) it returns when it finds it. From the start of the string, to …

Member Avatar for Ancient Dragon
0
229
Member Avatar for faysal.ishtiaq_1

Usually, I know before hand what the input will be - integer, string, double, etc. If I don't know what will be next, I take the data in as a string, using fgets(), into a char array[80]. From there it can be checked with various tests, char by char, to …

Member Avatar for Adak
0
158
Member Avatar for exfoxs28

The rand() function will repeat the very same numbers, in every run, unless you seed the random number generator ONE TIME, before you use it. So #include <time.h> #include <stdlib.h> //then srand(time(0)); //before any call to rand(), and you'll be all set. When you get a chance, you'll be miles …

Member Avatar for exfoxs28
0
240
Member Avatar for drieran

Set your system (like the rest of the world), to use UTC (aka GMT or Zulu time). Why? Because UTC is not affected by Daylight Savings Time changes. It doesn't change for it. [quote] The switch to daylight saving time does not affect UTC. It refers to time on the …

Member Avatar for drieran
0
245
Member Avatar for nitin1

Macros are pure substitution, and are handled by the pre-processor, before anything is compiled. Macros will be handled just as if you had entered the substituted code, without the macro. There is no run-time gain. They are a tool that can help if you sensibly, or hurt if over-used.

Member Avatar for sepp2k
0
178
Member Avatar for nitin1

Post a few lines of the csv (comma separated values): http://en.wikipedia.org/wiki/Comma-separated_values that you are having trouble with the input, and your code. It's best to get into the specifics, and see the actual data and code, rather than work from generalities of either data or code.

Member Avatar for deceptikon
0
261
Member Avatar for saurav2007

You've started coding, before you finished thinking about how it should be done. The array name should be arr[], not array[], correct? Think of the logic: make an array prod[] equal in size to arr[]. Do you know how to use malloc()? Then for(each value in arr[] except the current …

Member Avatar for parag29081973
0
233
Member Avatar for charishma

OK, but nothing was swapped. A swap of values doesn't mean simply reordering the variables in the print statement.

Member Avatar for Ancient Dragon
0
260
Member Avatar for Iamateur

If you sat down at the desk or table, and was given this string, could YOU find the date digits, inside the string? How would you do it? You'd probably start at one end of the string, and look through the string, for the first digit. When you found the …

Member Avatar for Adak
0
219
Member Avatar for prakash4

Not quite right though, sepp2k. 5.2 is an absolute value - it is NOT the same as the double a which was assigned the value of 5.2 AS A DOUBLE. 5.2000000 != 5.2000001 in your example. Try this: double a,b; a=5.2; b=5.2; if(a==b) printf("equal\n"); else if(a<b) printf("a is less than …

Member Avatar for sepp2k
0
287
Member Avatar for HackerSameer

The name of the header is <stdio.h>, not "studio.h", but your program shows it correctly. So, click on "options" and then on "directories", and check that your stdio.h file is listed as being in the directory that Turbo C++, expects to find it. It won't go looking all around for …

Member Avatar for Adak
0
123
Member Avatar for Prithwish

Printers have a language that you can control them with. Unfortunately, they don't all use the same langauge! Unless the printer you want to control is speaking your language, you won't be able to make it do what you want. Maybe start by reading up on PCL (Printer Control Language): …

Member Avatar for rubberman
0
319
Member Avatar for Vish0203

The prime has to be less than 1,000,000, but adding up the sum must be redone for every prime - but the program doesn't reset sum to zero, when it starts working on a new prime number.

Member Avatar for Adak
0
612
Member Avatar for Qwert_1

Just strcpy() the string, into your array that you have passed into permute, as a parameter. Note that the *b[100] array is local, and won't exist after the program exits that function. Use your own array, instead.

Member Avatar for Adak
0
230
Member Avatar for MadnessCow

Welcome to the forum! We are strongly encouraged to start a NEW thread, instead of adding onto a thread that is more than 6 months old. So I'd stop posting in this thread, and re-post your code and questions, in a brand new thread. That way you get the attention …

Member Avatar for Adak
0
6K
Member Avatar for Adak

Demonstrates the Right Hand Rule maze solving algorithm, with some sweet console colors and text display and erasing, in Windows. Note that if the Start is moved away from all the walls in the maze, the right hand rule fails, circling endlessly. Also, a similar failure happens if the Start …

0
3K
Member Avatar for Muhammad Waqar_1

No. That means your programs will start in main() (at least appear to start to us), in C. In fact, C programs may not start in C, (Pelles C doesn't), but in thinking about where the program starts in C, "it starts in main() in C". Usually, it's best to …

Member Avatar for Ancient Dragon
0
293
Member Avatar for Thundermax

Not &test with fscanf, just test. char arrays don't require an ampersand, like numeric variables do If you have other problems, specify what they are. Note that gets(), while it's very convenient, is totally unsafe from buffer overflow, and has been removed from the accepted C standard.

Member Avatar for Adak
0
153
Member Avatar for Falcon143

To optimize a program: 1) remember your first priority is always an accurate program. A wrong answer might be infinitely fast, but it's still wrong, and probably useless. Get and keep your program accurate. 2) the largest optimizing you can do, (by far), is with the choice of the algorithm …

Member Avatar for Falcon143
0
183

The End.