6,741 Posted Topics
Re: You miscopied the implementation, it's just a duplicate of the header, so I can't make any comments on your error except speculation. [B]>Why am i getting negative numbers and why is the iterations for rosenbrock just 1??[/B] I can't say why rosenbrock is 1, though with a name like rosenbrock, … | |
Re: [B]>so, please can anyone help me with this?[/B] Start by writing [i]something[/i], so we know you're actually engaging your brain and trying to learn rather than looking for freebies. | |
Re: Do you know how to divide two polynomials on paper? If not, figuring it out before writing a character of code strikes me as the proper first step. You can't write code to do something you don't know how to do. | |
Re: [B]>So the iostream allows for keyboard input[/B] At the risk of giving you too much information, there are several stages that your code goes through from source to executable. Here are the stages (bird's eye view): [list=1] [*]Source file: This is the stuff you write, exactly as you write it. … | |
Re: We have a forum for job offers. Perhaps you should post there instead of here. | |
Re: [B]>why would you bad mounth someone for asking a questions.[/B] Can you be any more melodramatic, Mr. Drama Queen? As much as goody goodies like you want the world to run on sunshine and fairy dust, negative reinforcement is the quickest way to alter undesirable behavior. Compare and contrast: [QUOTE][B]Exhibit … | |
Re: >i cant figure out whats wrong with my loop I know what's wrong with your loop: It doesn't exist! Compare this with your existing program: [code=cplusplus] #include <iostream> using namespace std; int main() { int number, digitCount = 0; cout << "Enter an integer: " << endl; cin >> number; … | |
Re: There's nothing wrong with it per se, but it's generally wiser not to confuse your readers with frivolous includes that aren't used in the file. | |
Re: Yes, you can. Go to Project and Properties, then somewhere in the myriad of options you'll see "Compile as C++" where you can change it to "Compile as C". And while you're at it, change the source file extension to .c instead of .cpp. | |
Re: [B]>No the complier had no problems casting a void pointer to a function..should it?[/B] It might. Technically void* and functions pointers are incompatible and converting between them is undefined behavior. I've seen compilers give both warnings and errors for such a conversion. The good news is that you can avoid … | |
Re: The simplest solution is to store the unique values in a second array. For each value in the original array, if the value doesn't exist in the second array, store it. When you've exhausted all of the values in the original array, only the unique values will be stored in … | |
Re: [B]>However, using code tags for something outside of code to achieve >a visual effect as a result of the current way code tags happen to be >handled cannot ever be guaranteed in the future.[/B] Translation: "Bite me. You didn't use tags for the narrow purpose they were designed, so you … | |
Re: C doesn't specify tab stops, only tab characters. It's up to the program consuming those characters to interpret the character with a certain tab stop length, just like it's up to the same program to accurately print the 'Q' character. Translation: change the properties of whatever program is displaying those … | |
Re: You can move the position (using seekg) either by an offset, or to a previous point (that was saved by tellg). Unless your file is very strictly formatted, you probably want the latter. So in your case, call tellg to get the file position before reading the fifth line, then … | |
Re: That's not what I would call "very difficult". You're also not likely to get any help by posting a homework assignment with no proof of effort. Show us that you tried to solve the problem first. | |
Re: [B]>so tell me when u ll start to learn me ???????? i m wating [/B] I'll learn you good. Start by not being so impatient. Everyone has to start from nothing and work their way up to something. Being given solutions doesn't help you learn nearly as much as working … | |
Re: [B]>//doesnt work to my knowledge >int average(ifstream& file_in);[/B] The parameters and return type are not dependent. If that prototype doesn't work, it's because you did something else wrong. How about posting a complete program that fails? | |
Re: The capacity of a container class has nothing to do with the OS, it's an internal mechanism of the C++ implementation. In other words, capacity will potentially return a different value for every single implementation of the standard library you use because the author of each library chooses how to … | |
Re: [B]>i spent lot of time in googling but couldnot get it.[/B] Hmm, perhaps that's because it's copyrighted and any free PDF you find is [I]illegal[/I]? If you want the book that badly, go buy it. If you can't afford it or don't want to buy it, then do without. It's … | |
Re: [B]>I would lookup random or srandom...for pseudo random functions in C [/B] Neither of which are standard functions, meaning unless the OP has the same compiler you do, the chances of your suggestion working are somewhat slim. srand and rand are the standard functions for seeding and generating random numbers. | |
Re: When you say something isn't working, it suggests that the code even compiles, which it doesn't. Does this work the way you expect? [code] #include <iostream> using namespace std; int main() { int option; do { cout << " WYZ Company\n\n"; cout << " 1 - for loop\n\n"; cout << … | |
Re: [B]>Please help me find the mistake![/B] I suspect the mistake is a complete failure to study whatever book on C you have. Instead of trying to finish this exercise in one swell foop, perhaps you should be writing a simple skeleton that passes structures around. At least that way you'll … | |
Re: Try Google. We generally refuse to spoon feed people code. | |
Re: >What worked in cave man days is no longer workable. Then what would you suggest? | |
Re: [B]>Google: the response to much and the answer to nothing.[/B] If you can't find complete information about I/O in C from google, you're either an idiot or a liar. It's easier just to say that you were too lazy to do a thorough search and need someone to point you … | |
Re: >[Linker error] undefined reference to `WinMain@16' You've created a project that's being built as a Win32 application. Those guys use WinMain instead of main as the entry point. If you want a regular C++ program, you have to choose the correct project type (which would be a console project of … | |
Re: [QUOTE=bluegoo06]i have a homework assignment using the calculatecharges function...we use C++...but my book doesnt have the actual usage for it in it. we have to calculate parking charges for cars in a parking garage...could someone please explain exactly how you would use this function to do that ... thank you[/QUOTE] … | |
Re: Read: [code=cplusplus] #include <fstream> #include <iostream> #include <string> int main() { std::ifstream in ( "file.txt" ); std::string line; if ( in ) { while ( std::getline ( in, line ) ) std::cout<< line <<'\n'; } } [/code] Write: [code=cplusplus] #include <fstream> int main() { std::ofstream out ( "file.txt" ); if … | |
Re: [B]>no help at all...but thanks anyway.[/B] Your capacity for patience is staggering. I mean, you couldn't even wait a full hour when it's either [B][I][U]SUNDAY[/U][/I][/B], or the wee hours of Monday all over the world. Good luck passing your class, and succeeding at a programming career, because you'll clearly need … | |
Re: >Something Like This Right, and that helps the OP delete an element from an [b]array[/b], how? >that removes an occurence of val in BBag? Just the first occurance, or all of them? The general process is to find the item, then shift everything after the item over it to fill … | |
Re: >Then why don't you suggest another way. How about you figure it out instead of encouraging people to do the OP's homework. | |
Re: >There is a Buit in function called getpass in conio.h Maybe on your compiler's flavor of C++. Just because it works for you doesn't mean it works for everyone, so at the very least mention your compiler and OS. | |
Re: >I also do not know what to write on the click event of the button. It's kind of hard to tell you what to write when I have no idea what you want the form to do. :icon_rolleyes: | |
| |
Re: The entire program should be nested in your do..while loop: [code] int main() { int number, dig1, dig2, dig3; char answer; do { // Everything else in here } while ( answer != 'n' ); } [/code] And you should consider allowing 'N' as well as 'n' to be more … | |
Now that you've added this extra statistic, it would be nice to also include a search filter based on votes. For example, say I want to search for all of my posts that have been downvoted, or posts with more than one upvote. Currently I have to do a search … | |
Does the search algorithm use the current contents of the database, or a snapshot? Because I can do a search for something I know exists in a recent thread, but it doesn't show up in the results. | |
Re: >I don't understand why you're leaving after having a post deleted. Just another childish person stomping off in a huff when things don't go his way. The best way to deal with such pitiful theatrics is to ignore them. | |
![]() | Re: Amazing. You took the time to add underscores so that your formatting wasn't lost and didn't bother to look for some kind of forum tag that would preserve it for you? [B]>PLEASE help pps!![/B] Here's a hint: realloc only works on memory that was previously returned by malloc, calloc, or … ![]() |
Re: >if(t=n) Note that in C++ the == operator is for comparison, = is for assignment. | |
Re: [B]>What is the difference between List and List_Info?[/B] The struct keyword. If you want to use List, the struct keyword is required. The whole point of typedefing a structure is to remove that requirement. Further, you can use the same name because structure tags and typedef names reside in different … | |
Re: >Surprising Salem didn't comment on this.. He probably doesn't want to explain it for the umpteenth time, like me. | |
Re: We usually start by thinking about what we want. Then we might even draw it before working up a quick prototype. If the prototype meets out needs, we do the full implementation. | |
Re: [B]>Is there a way to write a program in c++ that get a decimal number >and convert it to its equivalent in hexadecimal without using arrays ?[/B] Why yes, there is indeed a way. [B]>A bit guidance please ....[/B] I'm guessing that you refused to search the forum before posting … | |
Re: I suspect that if you fixed that piss poor formatting, you would easily find the problem. But noooo, you had to make it harder on yourself by writing code in a manner that [i]hides[/i] bugs. | |
Re: [ICODE]do[/ICODE] is a C++ keyword. That would probably hamper your ability to use it as an identifier. | |
Re: [B]>Your compiler will thank you for it.[/B] You mean your end users will thank you for it. What you described is called "Programming by Accident". It's a mindless approach to writing software that all programmers tend to default to because it's easier to do on autopilot. Unfortunately, too many professionals … | |
FASM can output an executable PE directly, but sometimes you want to output an object file for linking with modules in other languages. The following program can be used to link with the C library of the GCC compiler with the following commands: C:\>fasm hello.asm hello.obj C:\>gcc hello.obj -o hello.exe … | |
Some languages are hard to get started in. FASM appears to be one of these languages because the documentation is not detailed enough for a beginner. That's a shame because FASM is (in my opinion) one of the better assemblers. The following snippet is a simple Hello, world! program which … |
The End.