Posts
 
Reputation
Joined
Last Seen
Ranked #761
Strength to Increase Rep
+5
Strength to Decrease Rep
-1
68% Quality Score
Upvotes Received
4
Posts with Upvotes
4
Upvoting Members
4
Downvotes Received
2
Posts with Downvotes
2
Downvoting Members
2
5 Commented Posts
~41.0K People Reached
Favorite Tags
c++ x 38
c x 21
Member Avatar for lara_

>void main(){ main returns int. Since you can omit the return statement in C++, using int main on top of being correct and portable actually saves you one keystroke. It's a win-win situation. :)

Member Avatar for nootan.ghimire_1
0
7K
Member Avatar for Lost in Code...

>try using %s in the scanf's No, don't. At least don't until you know how to safely use %s and change the input variables to arrays. Otherwise you'll invoke undefined behavior and create security holes/mysterious crashes. >Is there a rule about the use of multiple scanf's? There's one that applies …

Member Avatar for bajishareef
0
5K
Member Avatar for phoenixlsk

>Doing a linked list using XOR ... I'm not certain what you mean. It's a hack to avoid wasting extra space on links. It takes advantage of the butterfly effect using XOR. If you take the XOR of two values and XOR it with either value, you get the other …

Member Avatar for manojthesingham
0
365
Member Avatar for prushik

>I would like to know once and for all how to convert a double to a const char* Casting doesn't work. You're not converting the double to a string with a cast, you're telling the compiler to use the binary representation of the double as characters in a string. For …

Member Avatar for Seta00
0
2K
Member Avatar for BigDAlcala

>I'm sure there must be some smart programmers like you who play this game. Only the kids. The rest of us play Everquest. :D >WoW is a monster of a program, is it not? It's probably a monster and a beast. Constant patching, updates, and expansions can wreak havoc with …

Member Avatar for techbound
0
124
Member Avatar for weasel7711

>I just wanted to change the first character in the sentence to >uppercase, what would I change to do that? Don't call toupper on every character, just on the first one: [code=cplusplus] void printSentence(char *sentPtr){ char *sent = sentPtr; *sent = toupper((unsigned char)*sent); while(*sent) { ++sent; } *sent++ = '.'; …

Member Avatar for Narue
0
187
Member Avatar for Arbhin

>I wanted to create a MMORPG. That's waaaaaaay beyond you at the moment. Focus on learning C++ as best you can, but don't expect to be able to write an MMORPG anytime soon. You need a lot of foundation knowledge to pull that off, I'm afraid. >For now, is it …

Member Avatar for Arbhin
0
128
Member Avatar for toxic

>i'm probably doing something basically wrong in the fubction maybe. Are you passing any arguments to your program? If not, argv[1] isn't guaranteed to be there, and if it is, it's pretty much sure to be NULL. If you're passing something, make sure that it's less than 30 characters or …

Member Avatar for Duoas
0
17K
Member Avatar for zandiago

>Do you think life would be better if we had start doing things the it ways years ago. Life is what you make of it. Of course, you should completely define what you mean by "better". :) >How long do you think it could last? About as long as it …

Member Avatar for iamthwee
0
216
Member Avatar for ChaseVoid

>But I heard it's now no longer in use. Managed C++ was the precursor to C++/CLI. It's still in use, but for new code you should be using C++/CLI as it's vastly improved. >C++/CLI could be counted as a new programming >language cause the syntax is similar to C#. C++/CLI …

Member Avatar for Ptolemy
0
218
Member Avatar for nitro

>I know the theory behind it but i dont seem to be able to put it into code! Then you don't really know the theory behind it. ;) Not to be rude or anything, but these are all pretty straightforward concepts and the code ends up being very short compared …

Member Avatar for Ptolemy
0
101
Member Avatar for #include_rose

>printf(head->data); printf takes a string as the first argument, not an integer. You probably just forgot to add the format string, which would make the line look like this: [code=c] printf("%d\n", head->data); [/code] If you don't mind, I'll make a few unrelated comments: >#include<malloc.h> malloc.h isn't a standard header, and …

Member Avatar for #include_rose
0
291
Member Avatar for Aarthi Gopal

>wen i use larger values say 245323465 etc. the sorted matrix returned garbage values.. y s that? Garbage values usually mean that you either didn't initialize the value in the first place, or you overflowed it through calculations. I'm guessing that you're seeing overflow errors that should be checked for …

Member Avatar for Ptolemy
0
105
Member Avatar for turkgames

I'd start with the fact that functions can't be nested inside of each other in C. You're also calling letter before it's declared.

Member Avatar for WaltP
0
97
Member Avatar for zandiago

>...Now where do i even begin? You could use everything you've learned in your previous threads that do something similar. >how do i store them so that the other lines are compared to it for the correct answer. Just store it in an array: [code=cplusplus] #include <cstdlib> #include <cstring> #include …

Member Avatar for zandiago
0
3K
Member Avatar for dddave999

If you understood the problem well enough to actually write this program, you wouldn't need to ask what language is best. I'll go out on a limb and say you're in over your head at present.

Member Avatar for dddave999
0
329
Member Avatar for Duki

>What about a purely iterative solution, that does not need the excess >memory, and is not logically limited in the number of values to display? That's fine for just printing the sequence. The array is more open to extension though. Let's say you want to write fib(x) where x is …

Member Avatar for Duki
0
746
Member Avatar for warpstar

>is dynamic memory allocation really necessaryÉ since you already >know the size of the array which is being passed by the caller Really? How do you know? If you're talking about the length parameter, then yes, dynamic allocation really is necessary because array sizes must be compile-time constants. This isn't …

Member Avatar for Ptolemy
0
161
Member Avatar for warpstar

>since its not returning anything? I don't understand. It's [b]clearly[/b] returning something because the code that calls the function uses the return value: [code=c] kptr = function2( n ) ; [/code] You can't use a function like that unless it returns something, and because kptr is declared as a pointer …

Member Avatar for WaltP
0
119
Member Avatar for zayalaksme

If it's urgent, won't it be faster to write it yourself than wait for someone to send you something that may or may not work like you want? Also, if it's urgent, it's probably homework, and using someone else's code is cheating.

Member Avatar for Salem
0
68
Member Avatar for vinaychalluru

It's better to put the code directly in your post if it's short. The problem is that floating-point values aren't always exact, so you can't reliably test for equality. The usual fix for your problem is to do a "close enough" test using the difference of the two values and …

Member Avatar for Ptolemy
0
124
Member Avatar for Duki

You can use the standard time library to do it, sort of: [code=cplusplus] #include <ctime> #include <iostream> void long_running_operation() { for ( unsigned i = 1; i != 0; i++ ) ; } int main() { std::clock_t start; std::clock_t end; std::cout<<"Beginning timer..."<<std::endl; start = std::clock(); long_running_operation(); end = std::clock(); std::cout<<"The …

Member Avatar for Duki
0
93
Member Avatar for Ptolemy

>I disagree. You have to have all kinds of special code to get scanf() to work properly. Only if you aren't using scanf for what it was designed in the first place. When you have to write workaround code to get a function to work, you're using the wrong tool …

Member Avatar for Dave Sinkula
0
412
Member Avatar for JesseQ
Re: Help

>i am currently getting 3 errors They're telling you that you can't use an array as the condition for a switch statement. You can only use integral values (or char, because char is an integral type).

Member Avatar for twomers
0
240
Member Avatar for megan-smith

If you're using scanf, you can just test the return value. It returns the number of items that were successfully converted: [code=c] int x; if ( scanf ( "%d", &x ) != 1 ) fprintf ( stderr, "Invalid input\n" ); [/code] The format string only has one specifier (%d), so …

Member Avatar for WaltP
0
574
Member Avatar for pyramid

>.533 microns converted to miles per hour = 3.311908 >.674 microns converted to miles per hour = 4.188042 Well, first, you need to remove the "per hour" part of that. The conversion is strictly distance, not distance over time. Second, you're neglecting to include the exponent in the miles value. …

Member Avatar for pyramid
0
306
Member Avatar for prushik

Do you really want to be casting away the precision when you call abs? Maybe you should be using fabs instead so that it gives you the absolute value without losing the precision.

Member Avatar for prushik
0
167
Member Avatar for koolboy
Re: help

>Is it really necessary to write your application in C or C++? It's probably an assignment for a C++ course, so yea, I imagine it's really necessary. Why do you ask?

Member Avatar for prushik
0
108
Member Avatar for locy

There's no way to print a binary value directly in C. You have to break the value up into bits and basically do it all manually: [code=c] #include <stdio.h> int main ( void ) { int x; printf ( "Enter a number: " ); fflush ( stdout ); if ( …

Member Avatar for locy
0
71
Member Avatar for lrnzsmok1

>This program is suppose to add, subtract, and print the complex numbers. It'd be 100% easier if you used the standard complex stuff from the <complex> header. Despite the name, it's actually quite easy. ;) >but im getting some type of error in one of the lines of my code. …

Member Avatar for Ptolemy
0
144