2,827 Posted Topics
Re: [QUOTE=greg022549;830676]This is one of the few times that I have used this web site. I am disappointed in the fact that I am looking for some help. I submitted a post called "GETTERS". I am very new to C++ and I was wanting to learn it. I turned to the … | |
Re: You are trying to create a Sudoku puzzle for a player to solve, or do you already have a puzzle and you are creating a function to see whether it is "legal" (no repeats)? Checking the puzzle for no repeats is a lot easier than creating a puzzle. Your description … | |
Re: [QUOTE=jimjohnson123;830833]This compiled successfully but I am not able to see if it linked correctly...can someone with visual studio test this out for me and see if it came back successful or not...[/quote] You can't program without a compiler. It's a waste of time. Programming is all about trial and error … | |
Re: [QUOTE=raymyster;830167]i fixed it anyway yesterday :) i really hate this about daniweb everytime i ask a question no one really helps, its like the answers i receive always" i cant help you i dont understand your question this is too long to be asked on a forum unlike 10 other … | |
Re: Look carefully at this block of code. You overwrite values without doing anything with them. [code] cout << "Enter the first five bar code digits " << endl; cin >> digit1 >> digit2 >> digit3 >> digit4 >> digit5; cout << "Enter the second five bar code digits " << … | |
Re: [QUOTE=djextreme5;830056]Can this program be shortened any further? [/QUOTE] Ah, a shortest code/code obfuscation contest. They're kind of fun sometimes and they've produced some of the worst coding practices known to man. We had a professor hold one for her 1st semester programming class and the department head read her the … | |
Re: [code=cplusplus] #include<iostream.h> #include<string.h> #include<conio.h> #include<math.h> char inf[][50]={"Id Number:\n","Full Name:\n","Address:\n","Birthday:\n","Civil Status:\n","Gender:\n","Education:\n","RatePerHour:\n","Date of Hire:\n"}; char *record[50][50]; int count; void AddRecord(); void ViewRecord(); void DeleteRecord(); void Payslip(); void main(){ char yn;int menu; do{ clrscr(); cout<<"ABC Company\n"; cout<<"Information System\n"; cout<<"<MENU>"; cout<<"\n[1] View Record\n[2]Add Record\n[3]Delete Record\n[4]Payslip\n->"; cin>>menu; switch (menu){ case 1: cout<<"View Records\n[Enter 0 to … | |
Re: [QUOTE=Rashakil Fol;789571]The program has finished, so the window closes.[/QUOTE] [QUOTE=kahaj;789574]Rashakil, it closes on me before it ever displays the sum. [/QUOTE] How can you tell? My eyes aren't that quick. I'm guessing it displays the sum, then exits in a blink. To the OP, this thread may be of some … | |
Re: [QUOTE=Intrade;829805]"Yes."[/QUOTE] Ditto. Yes with quotes around the word "yes". The phrasing of this sentence is a bit loose and inaccurate. [quote] I'm unsure of how declaring **x (a pointer to a pointer of x) is the same as declaring x[][] (a two-dimensional array of x's)... The theory I have is … | |
Re: I think we need more code to analyze this. If the program is less than about 250 lines, post it with line numbers: [noparse] [code=cplusplus] // paste code here [/code] [/noparse] That way there's no guesswork. The problem could be in the string-reversal, the negative handling, the absolute value handling, … | |
Re: [QUOTE=Moe;829550]Hello! I am writing a program to overload ~ operator to reverse the given string. Here is my program. The problem message is that"Could not find a match for string::string(char). I am writing my program on linux. I can not use strrev function. [code] #include<iostream.h> #include<string.h> class String { char … | |
Re: [code] #include <iostream> #include <iomanip> using namespace std; char getStuNames(char[][21], int); double getStuGrades(char[][21], double[][4], int, int); [COLOR="Red"]void displayGrade(char[][21], double[], int, int);[/COLOR] int main() { const int stu = 5; const int num = 4; char stuNames[stu][21]; [COLOR="Red"] double stuGrades[stu][4]; [/COLOR] getStuNames(stuNames, stu); getStuGrades(stuNames, stuGrades, stu, num); [COLOR="Red"] displayGrade(stuNames, stuGrades, stu, … | |
Re: [code] void compute::Add() { compute total; cout << "Enter number 1 " << endl; cin >> num1; cout << "Enter number 2 " << endl; cin >> num2; cout << "The amount is "; cin >> total; cout << endl; return 0; } [/code] You have a void function returning … | |
Re: [QUOTE=player183;828887]i'll make a quick translation too.. Equipe = team joueurs = players moyenne = average i'll recap what I need too , i'm looking for a command ( or function ) to get the min/max value of each the following : age / weight / height i'm really lost and … | |
Re: Thank you for using code tags! Please point out the line that is giving you the error (you can highlight it in red or just tell us what line to look for). | |
Re: Get rid of all of your [ICODE]system ("clear");[/ICODE] commands (you can put them back in again later after it all works, though lots of people recommend not using the system command at all and there are good threads explaining why). You can't debug well with them in there because you … | |
Re: [QUOTE=William Hemsworth;827618]>i donno how it even works lol Did you even write the code?[/QUOTE] Ditto William Hemsworth. Did you write this? What exactly do you want us to do with this? Simply fix it and post the corrected version so you can turn it in? | |
Re: [QUOTE=av11453;825795]Hi Jas, Thank you very much for the earliest reply on this post. Here not always i would have a variable format type like A010. It would be I9 or D06 or F05.10. If i always have A010 then i can use replacefirst method. Since i can substitue A10 with … | |
Re: Subscribe to O'Reilly Safari. They have all sorts of good books online. It's well worth the money and far cheaper than buying the physical books. | |
Re: You don't need [ICODE]using namespace std;[/ICODE] in the functions. You already have it at the top. It may not hurt anything, but it's unnecessary and generally is only put at the top of the program. You have an ifstream in main that you don't really use. You have ifstreams in … | |
Re: [QUOTE=trelek2;827164]Hi! The simulation looks ok, it even works fine for a head-on collision. But When I print out the balls velocities I find that the momentum wasn't conserved. Eg. balls of same mass, one ball is initially stationary, other going at 80pix/s: After collision I find that the velocity magnitudes … | |
Re: You can change your if statements to else if statements and simplify them: [code] if ((((test1 + test3)/2)*2) >= 90) cout<<name<<" has earned an A for the course."<<endl; else if ((((test2 + test3)/2)*2) >= 90) cout<<name<<" has earned an A for the course."<<endl; else if ((((test1 + test3)/2)*2) >= 80) … | |
Re: This is C++, so make your life easier and use the string library, with its find, erase, and replace functions. Find "do" and erase it or replace it with nothing. | |
Re: [QUOTE=deadmancoder;826999]hi ancient dragon.. thanks:) so it is a big task after all..:-O but my stupid professors wont accept it :D you know, they want us to complete a project within a week.. here's what they say, ;) 1. You have to develop an IDE (Very simple) with drawing tools to … | |
Re: [QUOTE=Nrod520;826571]I am using the program Eclipse, so i believe it is an applet.[/QUOTE] I'm a NetBeans guy (never used Eclipse), but I'm pretty sure Eclipse can do Applets and regular old non-Applet JFrames. Regardless, what exactly do you want to have happen? Are you trying to have a JMenuBar with … | |
Re: [QUOTE=grebnesor88;826509]thats the thing... i dont know where to start[/QUOTE] Start by deciding what you need to do to complete the assignment. From that list, decide what you already know how to do and what you do not. Decide the overall organization of the program. For example, what should the classes … | |
Re: I get these values in the foo variable when I run the program. Is this what should be passed to the system command? [quote] psexec \\a19-00 cmd.exe 'start www.google.com' psexec \\a19-01 cmd.exe 'start www.google.com' psexec \\a19-02 cmd.exe 'start www.google.com' psexec \\a19-03 cmd.exe 'start www.google.com' psexec \\a19-04 cmd.exe 'start www.google.com' psexec … | |
I finally got around to linking a website to my posts, but it's not showing up. I typed in the website URL in the "Home Page URL" box in my Control Panel, but I'm not seeing it on my posts. Did I do something wrong? | |
Re: Everything but a constructor needs a return type, so I assume you want this: [code] Point& Point::setPoint(double xPoint, double yPoint) [/code] since it matches this declaration in the Point class (see red): [code] class Point { public: Point(double=0.0, double=0.0); [COLOR="Red"]Point &setPoint(double xPoint, double yPoint);[/COLOR] double distance(Point & p); void print() … | |
Re: [QUOTE=odonal01;826493]plus, you would think that since this a C++ forum, that it would be in C++??[/QUOTE] Yes, you would think so? What's your point? | |
Re: [QUOTE=star4ker;826328]I am having trouble with this program which was solved before, but I am still having an issue with the final code. Here is the assignment prompt: Write a program that asks the user to order an ice cream treat. The user selects the type of ice cream, the type … | |
Re: [QUOTE=homeryansta;825788]ok, back with more questions. what is push_back? I want to say it is a function, but not certain.[/QUOTE] You need to become comfortable with checking documentation. It's a big part of programming. Find a C++ site that you like. I like [url]http://cplusplus.com[/url]. Just type in what you need into … | |
Re: [QUOTE=Takafoo;825808]Reverse the case of all alphabetic characters in the string. That is, all upper case characters become lower case and all lower case become upper case. Hello World becomes hELLO wORLD. So I figured I need to use the toupper and tolower commands. I'm just not to sure how to … | |
Re: We don't know what you are supposed to put in either because you haven't told us anything about what the program is supposed to do, whether it compiles, what lines give errors, and what those errors are. Also, please use code tags. | |
Re: [QUOTE=wonder_laptop;825639]hello there, can anybody please give me an example of how to use hashtables to implement a memory in cpp.. i surfed the net for 2 hours and couldnt find anything :S im not sure whether im submitting the right queries. thank you.[/QUOTE] Type "hash table tutorial" into Yahoo and … | |
Re: [QUOTE=cloud21;824959]Thanks for the help guys, so I need a player base class with an AI and human derived classes which both deal with the present card (rank and suit), the next guess,next card, the output result. So if the three card guesses are correct the human player wins but if … | |
Re: Working it out on paper will give you a better idea of how to do it. Your input is the number of days, you have a variable called days, so read the input into that variable. Having a variable called input is too vague. Does the number of days change? … | |
Re: Normally the idea on this forum is to not do things via PM since the goal is to make everything public, so you'll probably get a better response if you post the rules of the game on the thread. I imagine you'll need a function to shuffle cards though, probably … | |
Re: [QUOTE=Takafoo;822798] I know if I take the *number to number it will work but I've been told I have to have a pointer in the getNumber function but I don't know how else to do it.[/QUOTE] Been told by who, and why do you have to have a pointer? Is … | |
Re: I like verruckt24's idea. You have an image and certain parts of that image represent different "sections" (i.e. $10 bet section, $50 bet section, etc.). You need to have a mapping from the (x,y) coordinate to the section. Depending on how those sections are mapped out, you may want to … | |
Re: Aside from what you pointed out, I'm not sure what you are trying to do here in this node struct. What does children represent? Is there a children data type? Is that a constructor? Is there a function called children? [code] struct node { node* parent; [COLOR="Red"]vector<node*> children(1, NULL);[/COLOR] string … | |
Re: If you are terrible at math, that'll make things more difficult. The second estimation formula doesn't ring a bell, but the first does and is here. You should probably read the whole article and the links. [url]http://en.wikipedia.org/wiki/Pi#Classical_period[/url] It's a mathematical series. It gets closer and closer to an estimate of … | |
Re: What does this function do, what does it return, and what do the parameters represent? Have you checked whether it works? [code] bool winner(tttb my_Table, int ROW, bool isWin) [/code] You immediately assign isWin to be false, it's not passed by value, so why pass the parameter? Also, at the … | |
Re: [QUOTE=GrimJack;820049]I am sorry but I do not get USSC - a quick rule of thumb is whenever you use an acronym, the first reference should include an explanation.[/QUOTE] U.S. Supreme Court, I imagine. | |
Re: [QUOTE=Ancient Dragon;810299]That's crazy. "Four Yards Worth" shouldn't have an apostrophy. And there are other wrong answers too.[/QUOTE] My mom was an English teacher, so I'm going to check with her. I guessed correctly on that one, but that's assuming the author is correct. Some of the comma questions aren't clear … | |
Re: [QUOTE=mimis;810857]I am trying to solve an algorithmic problem. First of all the user inputs the coordinates of some nodes. I have to go to the node with the biggest x( let name it E) and then to return to the start that will always be the node (0,0)( let name … | |
Re: Please repost using code tags and formatting/indentation: [noparse] [code=JAVA] // code goes here [/code] [/noparse] | |
Re: Code tags please and please post the code with the array declaration so we know what the type is (is it an array of characters?). Regardless, you are overwriting everything you read in every trip through the loop. [code] while (! myfile.eof() ) { getline (myfile,truck_data2); } [/code] | |
Re: [QUOTE=xonxon;816862][code] int *p; int *q; p=new int; *p=35 q=new int; *q=62; p=q; cout<< *p << ","<< *q<< endl;[/code] wat is the value of *p n *q?why? the statement p=q refer to?[/QUOTE] I don't see a variable named n, so I assume n means "and" here. You need to put [noparse][/code][/noparse] … | |
Re: I did this project once, but I used a 2 x 2 grid rather than a tree. 0 cat 1 bat 2 cot 3 cog 4 dog etc. I'm not sure how you would do it with a tree, but I assigned each word an index. For each pair, I … |
The End.