6,741 Posted Topics
Re: >Does this meen that I will change this later when the application is finished ? Yes and no. When you run your application outside of the debugger (assuming you're using an IDE), a relative path will probably use the current working directory to look for files. Assuming you can make … | |
Re: >how can I make the last code shorter and more clear . I'd say it's plenty clear, and the only easy way to make it shorter is to drop the switch statement in favor of something like this: [code=cplusplus] // Find the display index of the selected column col = … | |
Re: I'd suggest always surrounding blocks with braces until you understand the rules. Properly indenting your code according to how your compiler sees things would produce this: [code=cplusplus] if(choiceMenuInput==1) input(); else if(choiceMenuInput==2) return 0; else printf("\n\n\n\n\n ERROR YOU HAVE ENTERED A WRONG CHOICE\n\n\n"); system("pause"); inputedit(); [/code] The last two lines are … | |
Re: >But what about the newlines and/or tabs? Indeed. And what about such monstrosities as "\t \n\n\t"? Does "extra whitespace" refer to adjacent whitespace characters of the same value, any value that isspace returns true for, or are we only working with the ' ' character? The problem doesn't seem to … | |
Re: The easiest way is to block for input using [ICODE]cin.get();[/ICODE]. However, that only works if there isn't anything left in the stream, which in this case is likely to happen. Change your code to this: [code=cplusplus] #include <iostream> int main() { std::cout << "Enter two numbers:" << std::endl; int v1, … | |
Re: >is there a quicker way to fill the list with A,B,C,...,Y,Z whithout doing all this? Yes, put your code to add a new node into a function, then use a loop: [code=cplusplus] int main() { struct node *current = 0; const char *alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; for ( int i = … | |
Re: >No, not currently, although you can see more in your >member control panel than is public in your profile. Is there any reason for that? I see rep as completely pointless except for the comments, which I enjoy reading. It would be nice if there could be a link to … ![]() | |
Re: >I'm trying to make a program that converts octal numbers to decimal numbers. I don't suppose this would work for you: [code=c] #include <stdio.h> int main ( void ) { int number; scanf ( "%o", &number ); printf ( "%d\n", number ); return 0; } [/code] | |
Re: >cin.get(sex); This only reads one of the two characters that are in the stream. The second character is '\n'. Conveniently enough, getline uses '\n' as a delimiter, so it's terminating successfully right away rather than blocking for input. Read [url=http://www.daniweb.com/forums/thread90228.html]this[/url] thread for more details on what the problem is and … | |
Re: >Ho can I get around this? You'll have to learn about working with multiple threads or multiple processes. That's a rather broad and complicated topic for a forum post though, try google. | |
Re: A stringstream is still a stream, you can't just copy a stream as std::vector does for its elements. Try using a pointer/smart pointer if you really want a vector of stringstreams. | |
Re: >vector<string> vect; >copy( istream_iterator<string>(is) , istream_iterator<string>() , vect.begin() ); The vector is empty, and copy won't call push_back for you. You need to add a back_inserter to the destination or copy will write to memory that you don't own: [code=cplusplus] copy( istream_iterator<string>(is) , istream_iterator<string>() , back_inserter( vect ) ); [/code] … | |
Re: >i want to access the addresses other than provided to me c compiler I'll guess that you mean you want to access arbitrary memory addresses. C allows it, but a system with protected memory isn't likely to be happy if you try it: [code=c] #include <stdio.h> int main ( void … | |
Re: >Its my dream to work in c or c++ under Linux platform Why? Your dream is a little odd considering that you're not familiar with Linux. I get the impression that you have some kind of idyllic misconception about the difference between Windows programming and Linux programming. It's great to … | |
Re: >I need to know why the designer of this website put in the software development Because people have questions about software development. >And why is designer of this page must to put web deve... Because people have questions about web development. >i do not know why do i need php … | |
Re: Your question can't be answered with the information given. All of those tasks are non-portable and depend heavily on your OS and compiler. | |
Re: Capitalizing the first letter of every single word makes your sentences harder to read. >I Have Thought Of Shift, Shift-rotate Etc But Can't Figure Out How To Do It You're probably trying to do it in-place and that's confusing you. Try building a whole new value by ORing the least … | |
Re: Presumably the problem is designed so that [i]you[/i] can learn how to specify a grammar given a limited syntax. If I solve it for you, you learn nothing. | |
Re: >but it only display "HELLO WORLD", no "!" sign There's nothing in your code that would cause this. In other words, the loop is correct. I'd guess that you're reaching a limit on the display. | |
Re: I've looked through your posts, The Dude, and determined that a certain measure of harassment through the reputation system has violated Keep It Pleasant. The parties involved have been dealt with accordingly. If you could send me a list of the posts that have rep you feel was part of … | |
Re: >if(find(newItem)!= -1) This doesn't make sense. You're only inserting into the table if the item already exists? :confused: I think you should avoid that confusion altogether and just hash straight from the insert function. >if(find(newItem)!= -1)// call to find index exist >hashVal = find(newItem);// know the position or hash That's … | |
Re: >Take all the printable/allowable characters and create a random >string with them. The longer the string the better your password. That's the logic for a secure password. A good password is sufficiently secure while still being memorable. Logic for a good password would be a phrase that meets the requirements … | |
Re: The first is legal, the second is not. But if you meant typename rather than typedef, the two are functionally identical. | |
Re: >can anybody help me with this? When someone says "can you help?" and only posts an assignment, we tend to assume that they want us to write it for them. Perhaps you should also post the code you've got, and if you don't have any code, try [B]something[/B] before asking … | |
Re: Are you subscribing to threads for email notification? Go to your Control Panel and under Settings & Options, select Edit Options. Under Messaging & Notification there's a Default Thread Subscription Mode. Make sure it's set to "Do not subscribe" or "No email notification". | |
Re: Is this a C++ programming question? | |
Re: >Is object-oriented approach is closer to the working of human cognition? You mean without training and experience? Closer to the way a human naturally thinks? Judging from how difficult most people find learning OO concepts, I'd say no. >Support your answer with strong arguments and real life examples. As much … | |
Re: This is a forum in which you can get help for writing your own code, not a service that provides code to you. | |
Re: Heheh. I guess if you don't want to get busted for cheating, you shouldn't cheat. | |
Re: What have you done so far? Note that Daniweb is not a homework service; we won't do it for you. | |
Re: GoTo only works within a method, you can't jump between methods. Maybe if you describe why you want to do this, we can offer a better solution. | |
Re: How about posting actual code so we know what advice to give you. :icon_rolleyes: >corr[8]="pizzaboy"; error-- cannot convert char* to char Presumably corr is declared as [ICODE]char corr[N];[/ICODE], which means that corr[8] has type char, not char*. >corr[]="pizzaboy"; error-- char has zero values Presumably this isn't a declaration. >corr[2]="z" ----- … | |
Re: I don't like your options. "good enough" rarely is, and perfection is usually a pipe dream. How about "good enough" versus doing it right? In that case I'd pick doing it right regardless of the time frame. | |
Re: Use sprintf to convert the number to a string and then print all but the first character: [code=c] sprintf ( buffer, "%d", value ); puts ( &buffer[1] ); [/code] | |
Re: >I was thus wondering if there's a way to "convert" a >va_list so that it can be used with a printf-like function. No, a variable argument list and a va_list object are directly equivalent to an object of type T and a pointer to type T, respectively. The types are … | |
Re: >Is there any way of proving that the += operator is more efficient than the + operator... Sure. Look at it and say "Hey, A is being evaluated twice with the + operator but only once with the += operator" and "Hey, A + B is probably making a temporary … | |
Re: >dev c++ and codeblocks seem to be dead now That's an odd statement to make when the most recent build of Code::Blocks was...today. | |
Re: >it goes in a infinite loop Because you're reading integers and not handling the commas: [code=c] fscanf(fp,"%d",&ch); [/code] This will always try to read a valid integer. fscanf doesn't find a valid integer, it'll fail and leave the offending character on the stream. ',' is not a valid integer character, … | |
Re: >Why i must enter ctrl+z 2 times to out from the loop..? The Windows shell has trouble handling EOF properly unless it's the first character on the line. Most likely you're doing something like this: [code] this is a test^Z ^Z [/code] The program only stops at the second ^Z … | |
Re: >Never heard of wofstream or Codecvt Facet wofstream is the wide character variant of ofstream. codecvt is basically meant for converting between different character encodings. >Any ideas why ? And mainly how to fix it ? I'd say that you either don't have Boost installed, didn't include the correct header, … | |
Re: >the stuff you can do in C can be done in C++, except build an O/S. Nope, you can do that in C++ too. C++ can be used anywhere C can, provided there's a compiler available for the target machine. | |
Re: >wow... can that be done in c++?? If it can be done at all, it can be done in C++, with one or two exceptions. >can someone tell me which API's to use for this?? Start with Allegro. It's relatively straightforward and easy to learn. | |
Re: More importantly, format your code so that code tags have a purpose. | |
Re: >Can anyone shed some insight on >cin.reset()? Does it really exist? No. By "reset", hopefully your professor meant for you to [url=http://www.daniweb.com/forums/thread90228.html]flush[/url] it. >Am I worrying about the exact wording of my prof's algorithm too much and just use You are, but he also didn't really communicate the task to … | |
Re: >a formula for computing the day of the week on which a given date fell or will fall. Wow, deja vu. | |
Re: >using namespace std; >is required for u 2 be able to use cin only No, it's not. You have to qualify for the std namespace to use any standard name, but a using directive isn't the only way to do it. In fact, it's probably the worst way to do … | |
Re: Okay, let me see if I understand your problem. You're basically writing an odometer where the characters on each wheel are specified by the first input string and the both the number of wheels and starting combination are specified by the second input. Then you need to print the combinations … | |
Re: >what do u guys think?? How about this? If you exceed 500 posts (Coffee House doesn't count), 50 solved threads, and maintain at least 4 green rep blocks, I'll give you one "get out of jail free" card. That means if you somehow accumulate enough infractions to be automatically banned, … |
The End.