6,741 Posted Topics
Re: >My friend and i were having a discussion the other day and we were >having a heated argument about how to make that dang diamond >pattern in C++ code A heated discussion, huh? Why not just write the damn thing and be done with it? There's not exactly anything to … | |
When you want to remove extraneous characters from an input stream in C++, it's usually because you mixed formatted and unformatted input methods. The formatted method would leave a newline in the stream and the unformatted method would consume it and terminate successfully, but fail completely to do what you … | |
Re: I see a disturbing lack of the main function, that just might be your problem. ;) Note that executable code needs to be in a function. | |
Re: [B]>First - unlike the most of you, I've read Microsoft's financial reports, and understand accounting.[/B] I find that statement somewhat insulting. "Unlike most of you, I know what I'm talking about...". Presumably you think "most" of us are oblivious pimple-faced kids in our parent's basement living off of ramen noodles … | |
Re: [QUOTE]since you are just starting, learn c and c++ first. these are a must learn. if u learn these then you should have no problem in learning others.[/QUOTE] Really? So by learning C and C++ I'll have no trouble with LISP, or Haskell, or APL? Sure, learning C and C++ … | |
Re: [B]>the only goal is strong protection.[/B] Why does your code need to be protected? Usually when someone asks for this, they're under the false impression that not being able to (easily) reverse engineer the code somehow makes the application more secure. | |
Re: Since this isn't an assignment, the correct answer is to ditch that piece of shit compiler and get something from the current decade. You'd have no end of troubles using a 16-bit compiler on a modern 32 or 64-bit OS anyway (the environment 99.99% of Turbo C folks are trying … | |
Re: [QUOTE]How can I print it from the main? I know it sounds stupid, but I am still a beginner to the language.[/QUOTE] There are three conventional options for accessing the calculated result in a function from the calling function: [list=1] [*]Return the result from your function: [code] #include <stdio.h> #include … | |
Re: A hardware barcode scanner will interpret the barcode for you and return a string. It's dead easy, just like reading from standard console input. | |
Re: Array sizes in C++ must be compile-time constants. In other words, you can't do that. However, you [i]can[/i] fake it using pointers and dynamic allocation: [code=cplusplus] cin>> size; int *array = new int[size]; [/code] But don't forget to free the memory. | |
Re: That was a question for a [i]job[/i] interview? If you couldn't answer it, I'm inclined to say that you're a perfect candidate. :icon_rolleyes: Anyway, the expected answer is probably that the for loop is counted and the while loop is not. Though that's only a superficial difference because you can … | |
Re: >This is a program convert a string to ASCII. No, it's a program that prints the integer value of each character in a string instead of the character representation. >#include <iostream.h> You're about ten years too late with this. The correct C++ header is <iostream>, and you need to qualify … | |
Re: >Can anyone explain me in simple language and better if with an >example why constructor don't have return types Here's an idea. Show us how it could be done without breaking all kinds of existing code, and you'll answer your own question. | |
Re: >Well from wot i no pseudocode isnt real code so how can i test it? The same way you test real code without running it: trace the execution with paper and pencil using a small amount of sample data. Not only does this give you a better idea of what … ![]() | |
Re: What you want is obfuscation rather than encryption, assuming the intention of encrypting the DLLs is to hinder reverse engineering efforts. There are a number of tools (Visual Studio comes packaged with Dotfuscator's community edition). Just Google for ".net obfuscation". | |
Re: >static int countChars( String str, char searchChar ) This only returns the count for a single character. So to find the most common character, not only would you be forced to call countChars for [b]every[/b] character in the string, you would also need to find a character with the largest … | |
Re: [B]>Is this Program Correct? or is there more conditions to check..?[/B] No and no, respectively. Your algorithm for the leap year condition is correct, but your code has a little to be desired. [B]>#include <conio.h>[/B] This header is completely unnecessary for this program. I highly recommend you get out of … | |
Re: >I have read that this requirement is going to be relaxed in the next >revision of the standards, but no compilers have implemented that >yet (for obvious reasons) Mixing declarations and executable statements is a feature that's been available since C99, and quite a few compilers support it. | |
Re: [QUOTE]The code is awesome.[/QUOTE] That's debatable. [QUOTE]Why is that temp = *q done inside else loop too?[/QUOTE] An oversight most likely (given the quality of the rest of the code). Good luck getting harshchandra to reply though, last activity from that account is from 2007. | |
Re: >i just want to whether there is a replacement for getch() in C++. There isn't a standard equivalent for getch in either C or C++. >my friend said getch() is C function. No, getch is a compiler extension. You can use it in either C or C++ if your compiler … | |
Re: >Researching and creating a limited compiler that works on a subset of a >chosen language is a very beneficial learning excercise for the computer >engineer / software developer. Writing a compiler is a beneficial learning exercise, but not a C++ compiler. That's like saying that a hand made tool shed … | |
Re: [QUOTE]So , what's wrong with your program ?[/QUOTE] I think he's just showing it off. | |
Re: >What is standard practice? Most people just define their own as needed: [code=cplusplus] const double PI = 3.141592; [/code] | |
Re: Storage classes specify where an object is stored, its visibility (linkage) and how long it exists (storage duration). There are three forms of linkage (summarizing): [LIST] [*]external: The object is visible across the entire program. [*]internal: The object is visible only to a single file. [*]none: Basically a "super internal" … | |
Re: If it's a square matrix then you can do it with something like this: [code] for (int i = 0; i < 4; i++) { for (int j = i + 1; j < 4; j++) { int save = matrix[i][j]; matrix[i][j] = matrix[j][i]; matrix[j][i] = save; } } [/code] … | |
Re: This solution won't work for you, but it should give you a push in the right direction: [code] #include <iostream> using namespace std; char letter_grade(int grade_num) { char limit[][4] = {90,80,70,60,'A','B','C','D'}; for (int i = 0; i < 4; i++) { if (grade_num >= limit[0][i]) return limit[1][i]; } return 'F'; … | |
Re: [code] #include <stdmagic> using namespace std; int main() { magically_do_something_platform_and_implementation_specific(PLAY_MUSIC, "hello.mpg"); } [/code] By the way, what OS and compiler are you using? :rolleyes: | |
Re: >C++ is a superset of C Not really. A is only a superset of B if A contains everything in B (and optionally more). This isn't the case with C and C++, especially considering the evolutionary path of C since C++ was created. Rather, C++ is based on C, and … | |
Re: [QUOTE=Melando;1703232]Attention: rtrim could modify memory outside string range[/QUOTE] While you're correct, the bug report is unhelpful because you haven't specified when this would happen or suggested a fix. The problem stems from an unchecked decrement of [ICODE]original[/ICODE], which can drop below [ICODE]string[/ICODE] if it's empty of contains nothing but [ICODE]junk[/ICODE] … | |
Re: >right now it is only to make sure we are more marketable >as our company is going down the tubes. Changing your implementation language because it's more "popular" isn't going to save a company. >I would imagine, it must be popular due to the benifits it has over VB. Not … | |
Re: I can easily see this thread being kept alive for four [b]more[/b] years with "me too!" posts, so I'm closing it. | |
Re: C99 added __func__, which evaluates to the name of the currently executing function. __FUNCTION__ is a common non-standard extension that does the basically same thing. | |
Re: >What is the use of using namespace std; ? Namespaces are like drawers in a filing cabinet. All of the standard library is in one drawer, and the only way to get to the stuff in that drawer is to tell C++ where to find it. You do that by … | |
Re: [QUOTE]My thought process was that I could start the loops at the beginning and the end of the string and then swap the two characters. Then, I could increase the iteration of the beginning by one and decrease the iteration of the end by one, and the repeat the swap.[/QUOTE] … | |
Re: I've pretty much just stuck with cats. Presently there are two in my home (plotting my demise, no doubt): Narue and Newton. | |
Re: [QUOTE=max2011;1437914]hi. i am marsh a student guys i have a activity but i don't know to start it with a loop. can you help me? ***** ***** **** **** *** *** ** ** * * ** ** *** *** **** **** ***** *****[/QUOTE] This is actually easier than the corresponding … | |
Re: >void main (void) This is not (and never has been) correct C. The main function returns int. >a variable of type char is just an 8-bit int. Just to be thorough, even though your reply is over a week old, char is only guaranteed to be [i]at least[/i] eight bits. | |
Re: I know that it's easy to misread "Daniweb" as "rent-a-coder", but we don't do that here. If you have a specific problem we can help you, but we won't do your work for you and hand it to you on a silver platter. | |
Re: The guy already had his interview, binoj_daniel. You're a year late. | |
Re: Here's as simple as it gets with separate chaining, with some rudimentary testing. I wrote it in a few minutes, so don't blame me if there are bugs. ;) [code=c] #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct node { char *data; struct node *next; } node; unsigned djb_hash ( … | |
Re: Is <iostream.h> the new <graphics.h>? :icon_rolleyes: Here's an idea: update your code to use <iostream> if your compiler doesn't support the non-standard and non-portable <iostream.h>. | |
Re: [code] if (islower(*sPtr)) *sPtr = toupper(*sPtr); [/code] There's no need for islower because toupper will convert the character as requested, or do nothing if there's no conversion or if the character is already upper case. In other words, toupper "just does the right thing". However, because your function can't guarantee … | |
Re: [QUOTE]Is there a basic criteria for a entry level programmer?[/QUOTE] When hiring entry level programmers, I've always looked for three things: [list=1] [*][B]Willingness to learn[/B]: Since we're talking about bottom of the barrel as far as applicable skills goes, the candidate absolutely must be a sponge for knowledge. [*][B]Passion[/B]: Entry … | |
Re: >why are there so many programming languages out there? [satire] I was wondering, why are there so many tools out there? I mean, I've learned a bit of hammering, a bit of wrenching and a bit of screwdrivering (which I didn't like) and I was wondering, why others keep making … | |
Re: >this seems to work but only for up to 4 letter words somehow. It seems the size of a pointer is four bytes on your system. >char * ret = (char*)malloc(sizeof(array) + 1 + 1); sizeof doesn't do what you want here. It's giving you the size of a pointer, … | |
Re: Last I checked (which I admit was a while ago), there weren't any free tools that I would put on a list along with splint. I use PC-Lint and Flexelint for C++ but they're neither free nor cheap. | |
Re: I suspect they use several. Can you be more specific about which feature of facebook you're referring to? | |
Re: [QUOTE]Hi Can you change my username to libertyreservehosting[/QUOTE] Can do. | |
Re: I imagine that those are member functions and their definitions need to be prefixed with [INLINECODE]playerType::[/INLINECODE]. |
The End.