6,741 Posted Topics

Member Avatar for roryt

>like a one-chance sort of thing where you're in probationary status, repeat offense would be irrevocable? Infractions already expire. Though in some cases we apply a permanent ban after the second chance.

Member Avatar for jephthah
0
534
Member Avatar for kbmmartin

[QUOTE=siddhant3s]Promise me that you/ your students will not ask questions like these in forums like these.[/QUOTE] You should be ashamed of yourself, and your attitude disgusts me. [QUOTE=siddhant3s]For the beginners of C++, The standards should be treated as Laws. For experienced programmers, these things will eventually clear up as you …

Member Avatar for siddhant3s
0
6K
Member Avatar for Duki

>For example, 2^3^4 should be evaluated as 2^(3^4). >So I should get 2^81, instead of the usual 2^12. Erm, it looks to me like the input is supposed to be prefix rather than infix. If you're getting 2^12 for your result, then I suspect you aren't entering the correct expression. …

Member Avatar for Duki
0
486
Member Avatar for preet4fun

[code=cplusplus] #include <iostream> #include <string> class Foo { public: Foo() { throw std::string ( "poop" ); } }; int main() try { Foo f; } catch ( const std::string& msg ) { std::cerr<< msg <<'\n'; } [/code]

Member Avatar for siddhant3s
0
145
Member Avatar for MindControl

>So to understand these codes detail what kind of books i have to read and tutorial i have to learn. Why don't you just read the documentation on MSDN? It's all there. >strcat(system,”\\virus.exe”); *sigh*

Member Avatar for Narue
0
164
Member Avatar for ssDimensionss

[QUOTE=tux4life;855287]If a function doesn't require any arguments in C you have to put the [ICODE]void[/ICODE] keyword between the function's '(' and ')' brackets (if you really want to be correct :P), like this: [ICODE]int main(void)[/ICODE][/quote] You don't have to, but it's a good idea for the sake of consistency and …

Member Avatar for Narue
0
211
Member Avatar for skisky

>std::transform(msg.begin(), msg.end(), msg.begin(), std::tolower); Congratulations, you've propagated one of the more annoying bugs among C++ help forums[1]. 1) tolower isn't just a function in <cctype>, it's also a template in <locale>, which is allowed to be included by any standard header (<iostream> is the usual culprit). As written, there's an …

Member Avatar for Narue
0
317
Member Avatar for ubipg

Post your code and trim it down to the smallest parts that can be compiled. I'd guess that you're missing something, like a definition for the function or you're not linking the files correctly.

Member Avatar for ubipg
0
243
Member Avatar for rEhSi_123

>Also I have googled for "windows form application in c++" and very little has comeup! Really. None of the 35 million hits was even close to relevant? I find that hard to believe, especially when the first page looks both relevant and useful. >How can I do this? Handle the …

Member Avatar for rEhSi_123
0
279
Member Avatar for binamy1

>Without No Reason Damn straight. There's always a reason, even if it's not immediately obvious to you. >when i started using variable block sizes it crashes Then your first task should be verifying that you're reading from/writing to memory that you own. I'd wager that your problem is an out …

Member Avatar for binamy1
0
139
Member Avatar for aashishn86

>And learn VB.NET, VB6 is dead. VB6 is dead like COBOL is dead. It's not the latest and greatest, but you can make a damn good living with it. ;)

Member Avatar for Narue
-1
289
Member Avatar for BlackStar

You can only switch on integer values. This restriction makes more sense when you think of a switch statement as a table lookup where each case is an index into the table. >switch (choice[0], choice[1], choice[2], choice[3], choice[4]) >and that didn't give me a compiler error, but would this be …

Member Avatar for Narue
0
117
Member Avatar for harrykokil

>i have no clues on how to begin this Then either you weren't paying attention in class (if you're a student) or you're woefully unqualified for your job (if your a professional). I'm especially unsympathetic to people who claim not to have a clue and then ask me to do …

Member Avatar for ithelp
0
111
Member Avatar for Clockowl

>I don't know exactly why it's needed either. There's the potential for a parsing ambiguity when you use dependent names[1]. Let's look at an example: [code=cplusplus] template <typename T> void meep() { T::Baz *p; } [/code] Clearly this code is intended to create a pointer to T::Baz and T::Baz is …

Member Avatar for siddhant3s
0
2K
Member Avatar for Aia

>It's only been two days I wouldn't call that a statistically significant sample then. It could just have been a heavy two days for new registrations. :icon_rolleyes:

Member Avatar for martin5211
0
315
Member Avatar for Sky Diploma

The declaration syntax is probably the biggest wart C++ has. Here are a few tricks for figuring out what a declaration means, or how to write one: [LIST=1] [*]Simple declarations can be read backward to get the real meaning: [ICODE]int *p;[/ICODE]: p is a pointer to int [ICODE]int **p;[/ICODE]: p …

Member Avatar for MrSpigot
0
260
Member Avatar for Crago3

It looks to me like you took three different solutions you found on the web and mashed them together into one hideous mess. Compare and contrast: [code=cplusplus] #include <iostream> int main() { char ch; while ( std::cin.get ( ch ) && ch != '\n' ) { if ( 'a' <= …

Member Avatar for Narue
0
177
Member Avatar for freddyfly

>It doesn't seem to me that creating this would cause a segfault... Just because it dies there doesn't mean the problem occurs there. Don't confuse the symptom for the cause and you'll understand why memory errors are among the more insidious bugs you can encounter. Sadly, you haven't provided enough …

Member Avatar for freddyfly
0
234
Member Avatar for daviddoria

[ICODE]clog.rdbuf(clog.rdbuf());[/ICODE] doesn't do anything meaningful. You've already replaced the stream buffer, so the original one is gone unless you save it elsewhere: [code=cplusplus] ofstream ofs("file.log"); // Save the original stream buffer streambuf *clog_save = clog.rdbuf(); clog.rdbuf(ofs.rdbuf()); clog << "Logged." << endl; ofs.close(); // Restore the stream buffer clog.rdbuf ( clog_save …

Member Avatar for Narue
0
120
Member Avatar for Clockowl

all_nodes is an empty vector, merge is trying to access indices that don't exist. If you want all_nodes to be populated by std::merge, you can do it with a back_inserter: [code=cplusplus] #include <iterator> merge(from.begin(), from.end(), to.begin(), to.end(), back_inserter(all_nodes)); [/code] Alternatively you can resize all_nodes so that you no longer overrun …

Member Avatar for Clockowl
0
123
Member Avatar for bkeenom

This is a risky venture because people expect array notation to have random access performance characteristics. Linked lists are not random access, and simulating random access is not only relatively expensive, it becomes more expensive as the list grows and the subscripts get larger: [code=cplusplus] Polynomial& Database::operator[] ( int i …

Member Avatar for bkeenom
0
130
Member Avatar for Nick Evan

I match several, depending on my mood and whom you ask: [URL="http://redwing.hutman.net/~mreed/warriorshtm/bigdogmetoo.htm"]Big Dog[/URL] is probably my closest match. I even have several Me-Toos, but I won't name them. Occasionally I feel like [URL="http://redwing.hutman.net/~mreed/warriorshtm/godfather.htm"]Godfather[/URL], but I jump into the fray too often for it to be a good match. And of …

Member Avatar for Narue
0
320
Member Avatar for Sturm

>Watch this thread get deleted... just like my tutorials. Wow, you're not bitter about it at all, are you? :icon_rolleyes: It's nothing personal, so don't take it personally. Acting all whiney and childish doesn't help your cause, unless your cause is to destroy your own reputation.

Member Avatar for happygeek
0
186
Member Avatar for orwa
Member Avatar for MosaicFuneral
0
184
Member Avatar for kelechi96

>except one thing needs a bit stronger emphasis. >never, ever use "GOTO" this is not BASIC programming. Note to the OP: Avoid listening to programming advice that says you absolutely must or must not do something.

Member Avatar for kelechi96
0
170
Member Avatar for usman2k4u

>Nobody help this lazy @$$ clown. We wouldn't have anyway. Cheaters and leeches are quickly shunned from the community. p.s. You don't need to trick the censor, "ass" is perfectly acceptable here.

Member Avatar for usman2k4u
0
286
Member Avatar for badboizEnt

You have to do that work yourself now, because you've sidestepped the shell and taken over its job. Now it's your job: [code=cplusplus] #include <iostream> #include <string> #include <conio.h> std::string get_password() { std::string password; int ch; while ( ( ch = getch() ) != '\r' ) { if ( ch …

Member Avatar for way29
0
1K
Member Avatar for Francis87

If the replacement text is exactly the same length as the text being replaced, you can search the file and then overwrite what you need when you find it. Otherwise, you're probably stuck with the temporary file approach. Alternatively, you can keep the records in memory and edit them to …

Member Avatar for ArkM
0
313
Member Avatar for ammonation42
Member Avatar for danishamman

>Plz provide me complete discription of four algorithms used for sorting arrays e.g bubble sort. How about you tell us what you came up with first, because this is clearly homework. >Four bad sorts: Okay. >bubble sort Works for me. >insertion sort Insertion sort is not a bad sort. It's …

Member Avatar for jephthah
0
229
Member Avatar for camonchain

>Coders will have your head for not using argc and argv. xD Nah, but the hungarian notation will start wars. ;)

Member Avatar for jephthah
0
194
Member Avatar for oracle123

>le sigh. :D It seems you've suffered enough for that bit of code, so I'll restrain myself.

Member Avatar for jephthah
0
4K
Member Avatar for dulahdaglace

Try this and see if you get more information: [code=cplusplus] #include <cstdio> #include <fstream> #include <string> #include <iostream> using namespace std; int main() { string filename; cout<<"Please type the name of the file"; cin>>filename; fstream file(filename.c_str()); cout<<filename.c_str(); if (!file) { perror("file could not be opened"); exit(1); } //... } [/code]

Member Avatar for dulahdaglace
0
244
Member Avatar for want_to_code

>why does the above code work? Because there are only two things you can do with a function: take its address and call it. If you're not doing one, you're doing the other, and C basically ignores redundant levels of indirection on a function. This will work too: [code=c] #include …

Member Avatar for Nick Evan
0
299
Member Avatar for invinate

>This wouldn't be a problem for me in C, but i want to do it in C++ You can use a C solution in C++, you know. But that aside, just read each line and don't do anything if the first non-whitespace character is '#': [code] #include <fstream> #include <iostream> …

Member Avatar for satarupa
0
543
Member Avatar for grandalf62

>Error C208 DS1302GetAll Too many actual parameters This is how you are declaring DS1302GetAll: [code=c] void DS1302GetAll(SYSTEMTIME *Time); [/code] This is how you are calling it: [code=c] DS1302GetAll(Second, Minute, Hour, Date, Month, Week, Year); [/code] I'd say your error is quite right in saying that you're passing too many actual …

Member Avatar for grandalf62
0
249
Member Avatar for moiron

What have you tried? Staring at your keyboard with a dumbfounded expression is unproductive, and I suspect that your teacher wouldn't have given you this assignment without providing any prerequisite information. Here's a start: [code=cplusplus] #include <iostream> int main() { int num; while ( std::cin>> num ) std::cout<< num <<'\n'; …

Member Avatar for jephthah
0
111
Member Avatar for krellor

This is the original code, right? [code=c] char *cTempPtr = NULL, search[256] = "init"; cTempPtr = argv[1]; strcpy(search, cTempPtr); [/code] The equivalent of that without using cTempPtr is as follows: [code=c] char search[256] = "init"; strcpy(search, argv[1]); [/code] There's no magic involved between assigning cTempPtr and using it in strcpy, …

Member Avatar for gnujohn
0
230
Member Avatar for karen_CSE

I don't think your question will get an answer seeing as how karen_CSE hasn't been active since 2006.

Member Avatar for Narue
0
425
Member Avatar for SmokyMo

>cout<<fly.freeSeat; freeSeat is a function. Even if there are no arguments, you still need the (empty) parameter list: [code=cplusplus] cout<< fly.freeSeat() <<'\n'; [/code]

Member Avatar for SmokyMo
0
137
Member Avatar for xonxon

I highly recommend formatting your tree in a text editor set to a monospace font. I'm assuming this is the tree you wanted: [code] A / \ B C / \ / D E F / \ G H [/code] Normally when people ask "is this right" questions, I reply …

Member Avatar for Grn Xtrm
0
87
Member Avatar for Parisa1984

The answer to your question is no, because the #include directive is run at compilation time. It's long done by the time you run your program at all, much less on another machine. To change the path in the directive, you'd have to recompile. Usually a relative path is sufficient: …

Member Avatar for Narue
0
85
Member Avatar for Nusubito

[psychic debugging] You're probably forgetting to initialize one of your variables to zero or something suitably reasonable. [/psychic debugging]

Member Avatar for Narue
0
40
Member Avatar for YaelGD

>Any suggestion? I'd suggest that you confirm the need to do this without any kind of list. This sounds more like make-work with unreasonable restrictions than a beginner's project. Since you claim that it's a beginner's project, it's more likely that you just didn't fully understand the requirements and have …

Member Avatar for Narue
0
116
Member Avatar for harshaldhote

Read [URL="http://www.eternallyconfuzzled.com/tuts/algorithms/jsw_tut_sorting.aspx"]this article[/URL] and pick an algorithm to use. To sort strings, the easiest way is to compare with the strcmp function and swap with the strcpy function (both found in the string.h header). Note that to sort all of the strings, you'll want to keep them all in memory …

Member Avatar for jephthah
0
384
Member Avatar for lancevo3

cin.getline will give you a line from the file: [code=cplusplus] #include <iostream> int main() { char buf[1024]; if ( std::cin.getline ( buf, sizeof buf ) ) { std::cout<< buf <<'\n'; } } [/code] Ideally you would use the std::string class, but I'm not sure if you've gotten far enough in …

Member Avatar for nucleon
0
111
Member Avatar for Bladtman242

>What can .net be used for? what is it good for? In my opinion .NET is best used for applications and services where the overhead of the framework is acceptable. I can't stress enough how much more pleasant GUI applications are to write in .NET than in Win32 or MFC. …

Member Avatar for Bladtman242
0
423
Member Avatar for meistrizy

>how do I sort both department and gender? The keys are rolled up in a single object, so all you need to do is modify your comparison for the sort. Try comparing both the department and the gender in the same if statement.

Member Avatar for meistrizy
0
215
Member Avatar for darkagn

>A field such as First Language and possibly one for additional >languages spoken might be useful for those who take issue with >people struggling to describe the problems they are having. In my experience, we're generally pretty good at determining if the communication barrier is due to legitimate language problems …

Member Avatar for MidiMagic
0
203
Member Avatar for Intrade

I can't help but reply since I'm probably one of the 'Vets' the OP is talking about. ;) >why does it seem like some of the posts here are an ego-contest? I'd wager it's because programmers tend to have big egos. It's also a game, which I'll describe shortly. [QUOTE]Result …

Member Avatar for MidiMagic
0
220

The End.