6,741 Posted Topics
Re: >which can be used by including. #include <fstream.h> Please don't encourage the use of pre-standard headers. We're getting to the point where compilers will refuse to build code that uses them. | |
Re: >putc() would output 1 character only, and not really useful or effective in this case. You must have missed the part where he said "in a loop" and "to display each character one at a time". Of course, the question is a bit ambiguous. | |
Re: Asking for answers to be sent to you is against the rules. We also have a policy of not giving answers to those who have shown no effort. So please give the problem a try before begging for freebies. | |
Re: >*ptr = toupper(*ptr); You forgot to include ctype.h. >/* first letter of string */ This is a benign logic error. The end result is that it doesn't cause a problem if the first character in the string isn't a letter, but the fact that you always do it suggests a … | |
Re: >its a very simple logic You'd think, but that might not be the case. >but the problem is its showing segmentation fault. I'd wager my next pay check that you're trying to strtok a string literal. | |
Re: Either you're incredibly dense, or you're putting way too much thought into something simple. Given [INLINECODE]char *str = "Hello"; [/INLINECODE], "Hello" is const, str is not. The assignment is allowed, but you can't use str to modify "Hello". That's as deep as it goes, so stop digging. | |
Re: >see .net makes it easy to connect to different data sources like >databases, access files, and xml files. This is true. >but whenever I look in C++ books they always talk about using the STL >like lists, stacks, and other structures. That's because those books teach standard C++ and can't … | |
Re: It sounds like you want the equivalent of getch and kbhit. Search for those two on these forums and you'll find sample code for those functions and alternatives. Keep in mind that what you want to do isn't portable. | |
Re: >need a simplified version That's easy, there's no such thing. Be specific about the context in which the algorithm would be used and an efficient one can be suggested. | |
Re: My Pascal is a tad rusty, but I'm reasonably sure the C++ translation is thus: [code] void gPacker::InvertInteger ( unsigned int i ) { Result = ( i & 0xff ) << 24; i >>= 8; Result += ( i & 0xff ) << 16; i >>= 8; Result += … | |
Re: Your types are all screwed up. You use charT, traitsT, and diff without defining them, for instance. | |
Re: C-style strings aren't compared with ==, you have to use strcmp or equivalent. What you're doing now is comparing two addresses that are unlikely to be the same, not the contents of two strings. ![]() | |
Re: n is a highly suspect name for a global variable. Did you accidentally declare a local variable n that was not an array? The global n would be hidden by the local n and you would get that error. | |
Re: >Why would it use two different copies of strcmp? Presumably the two copies are the standard strcmp and your own strcmp with the same name. Overriding a standard function with a custom function of the same name is tricky business. >How do I force it to use my version? Give … | |
Re: Does rep still fade away into nothing on the control panel? I'd love to be able to page through all of my rep instead of the most recent 15. At the very least it would be nice to be able to search for a member's (mine or someone else's) posts … | |
Re: >as i missed the lectures and practical classes involving that.. You "missed" them? And the instructor as well as your classmates refuse to offer any help at all? That seems somewhat suspicious. Anyway, it's difficult to help you without seeing some kind of attempt because we can't judge your level … | |
Re: Split into a new thread. Please don't post unrelated questions into existing threads. | |
Re: There's a header called time.h (ctime in C++) that contains the functions and types you need. Try a google search for details, and if you have trouble with the actual implementation, feel free to ask here for help. | |
Re: MFC is a (large) collection of classes for writing Windows applications in C++. It's a wrapper around the Win32 API. | |
Re: >infact, i have made my website about c programming.. I'd recommend learning C before trying to teach it. Your code is poorly written and your explanations of the code are severely lacking. >Don't. Get the Express version of VS 2005: If you stick to C, Visual Studio 6 is okay. … | |
| |
Re: What the hell is up with all of the wxWidgets questions? | |
Re: Your class doesn't meet the requirements for a POD type, so using read and write is undefined. Add a couple of member functions that serialize your class to and from a string, then use that string for file I/O. | |
Re: Where's the rant and rave smiley? :@ doesn't cut it for my level of bitchiness. Are you trying to tell me something? ;) | |
Re: >so ANYONE dare to try You're making it sound like this program is difficult and it takes courage to complete when in reality it's trivial and takes little more than sufficient boredom to churn out a bit of code. So are you trying to get us to finish your homework … | |
Re: Eh, a general rule of thumb is not to loop with iterators if you're going to modify the container. The good news is that the algorithm header has a function template that you can use to remove all occurrences of an item: [code] #include <algorithm> cout << "Input course number … | |
Re: [code] int sum = 0; while ( n <= i ) { int save = n * 26 * n; sum += save; cout<< save <<endl; ++n; } [/code] | |
Re: Environment variables aren't expanded in string literals. You need to call something like getenv to get the value: [code] #include <cstdlib> //... const char *appdata = std::getenv ( "APPDATA" ); if ( appdata != 0 ) { std::string path = appdata; path += "\\Folder\\file.txt"; std::ifstream file ( path.c_str() ); //... … | |
Re: >Why use Win32 api? Why not? >It is C (Microsoft C plus Standard C). A C API can be used by C++ too. >For GUI programming in Windows use MFC (Microsoft Foundation Classes) up to Visual C++ 6.0. I agree to a point. MFC helps for the things that MFC … | |
Re: >I will have to post it in a new thread once I get to a computer that has >that, probably tomorrow or the next day Don't start a new thread. Just reply to this one. | |
Re: >I want to know the optimization code for following c source code So you've profiled your code and found the code you posted to be a bottleneck? If you haven't done that, you have no business optimizing it. | |
Re: >If you could change one thing, what would it be? The time it takes for every page to load is painfully slow. Unless I disable advertisements, we're talking on the order of ten seconds from the time the page starts loading to the time I can scoll and click and … | |
Re: Where are you storing it? How you proceed depends on the quotation rules of whatever storage medium you're using. For example, if you were pasting that into a C++ string literal, you would need to escape the quotations for it to work: [code] "Set autoUpdateClient = CreateObject(\"Microsoft.Update.AutoUpdate\",strComputer)" [/code] | |
Re: >pls if you dont no how to solve the solution above do replay to me Rash knows the answer, as do many of us, but he's refusing to give it to you because the problem is clearly homework and you haven't shown any effort. >im seriase pls I'm serious too. … | |
Re: >I think it would be fun to ridicule them, as it seems like all the negative >repping is being done by 1-2 people... The logic is that if you know who gave you bad rep, you would give them bad rep in return. Personally, all I care about with rep … | |
Re: >I am new to this discussion community as you've probably already seen >but I'm not a dummy so don't talk to me like one! Whether you're new or not is irrelevant. You've shown a lack of concern for proper formatting despite being told in detail the merits of it. I'm … | |
Re: >if ( den = 0 ) { >while ( den = 0 ) { = is assignment, == is comparison. | |
Re: Please don't resurrect a year old thread with an unrelated question. | |
Re: >But one thing I've noticed the tutorials are so dull/empty,why? Probably because not many people are good at writing quality tutorials... | |
Re: >how can i get the medain value of these marks ? ( it may be even or odd) If it's odd, take the middle number. If it's even, find the mean of the two middle numbers. It's a cake walk. :) | |
Re: You're best bet is to get "Programming Windows, 5th Edition" by Charles Petzold. It's the definitive book on programming Windows applications with C. As for a tutorial, I always rather liked [url=http://www.foosyerdoos.fsnet.co.uk/]this one[/url]. | |
Re: You have plenty of options: pipes, sockets, environment variables, files... Just pick one and run with it. | |
Re: >Where do I put the array? There's only one place: main. But since you're using std::strings you're probably also in a position to use std::vectors as well. They should be preferred over arrays: [code] // Other includes #include <vector> // Person declaration int main() { std::vector<Person> v; bool done = … | |
Re: >but can any one tell me How the computer Reads it i mean how is the sontrol transfered plzzz Do a google search for "recursive fibonacci trace". Most of the pages will have at least one image showing you transfer of control within the recursive path. | |
Re: Please read our rules, FAQs, and stickies before posting. It saves you the embarrassment of making mistake #1 in asking for freebies. | |
Re: >Regardless of whether you are using C or C++, moving the '\0' character >around isn't the solution. (both languages have library functions for string manipulation) For C that statement is debatable. For a full trim it might be better to do the whole operation in one swell foop, [b]if[/b] strncpy … | |
Re: >Got it? Please. With that kind of explanation, even [B]I[/B] wouldn't get it. :icon_rolleyes: | |
Re: >i read that in C++ some programmers consider using break and continue >statements as a violation of structured programming practise....... and >usually avoid using them except in switch statements... That's because they're stupid. It's like the whole single entry single exit crap that structured programming aficionados spew. The result is … | |
Re: >But anyway, has anyone actually killed Ruby Weapon in Final Fantasy VII? Yes. Personally, I thought Emerald was harder. >Any tips or hints or strategies for it? You're going to lose two members of your party, so make sure that all of them can cast a powerful life and link … |
The End.