1,177 Posted Topics
Re: It looks like you are taking a sorted list and jumbling it? What is the significance of the different rows? You're going to have to show us you've tried before you will get any help. Post your code. | |
Re: I'm confused. Your title says "string to int to string", so I was looking for StringToInt() and IntToString() functions, but instead found hex and dec and those things. Can you remove all of the unnecessary code and hardcode the input so we can take look at only relevant material? | |
Re: This look very "c style" to me - maybe it should be moved to the C subforum? | |
Re: You mean there is nothing in the output file? It is not supposed to show anything on the screen... | |
Re: Please try a little bit before asking for help. I would expect the plusEquals function to take a parameter of type 'fraction' for starters. | |
Re: [QUOTE] I will denote the husbands with the following notations h1 = 11, h2=12, h3=13 and their respective wives with the numbers w1 = 21, w2 = 22, w3 = 23[/QUOTE] Why assign these ints to the people? Why not use something like this: [code] struct Person { public: enum … | |
Re: Can you use the getline function insetad? [code] string filename; getline(cin, filename); [/code] David | |
Re: Please use code tags when posting code. Also, please try to simplify your code before showing us. Surely it doesn't take 125 lines to demonstrate this error. I bet you can get it down to 20 :) | |
This page works fine in Firefox and Chrome: [url]http://ewh.ieee.org/r1/schenectady/events.php[/url] but in IE, the maincontent appears way at the bottom (below the sidebar) instead of to the right of the sidebar as it should. Google convinced me that IE has trouble with CSS, but this is such a basic thing I … | |
Re: Replace [code] player players[11]; [/code] with [code] std::vector<player> players; [/code] Then you can use .push_back() to add items to the end of the vector. If you're looking for random access deletion, you should use a <list> instead of a vector. | |
Re: You're on the right track. In the snippet below, the stringstream acts just like your file stream. [code] #include <iostream> #include <string> #include <sstream> int main(int, char *[]) { std::string line = "11/29/2010 S 2907 1"; int myInt; char myChar; std::string myString; std::stringstream ss; ss << line; ss >> myInt … | |
Re: Two things (maybe) 1) [icode] std::string squareArray[] = {"0","1","2","3","4","5","6","7","8","9"};[/icode] looks scary. I would use: [icode] std::string squareArray[10] = {"0","1","2","3","4","5","6","7","8","9"};[/icode] 2) It looks like you don't initialize your member variables. Make a constructor and in it initialize iTurn, turns, gameWon, and i. ('i' doesn't seem like a good candidate to be … | |
Re: Please use code tags when you post code. Please tell us an example input, the expected output, the current output, and any compiler errors. Also, please use English - unfortunately most readers of this forum would have no idea what that code is supposed to be doing. David | |
Re: A priority queue acts just like a queue but rather than maintain the order that the items were added to the queue, the priority queue sorts the items as they are added. Here is an example: [url]http://programmingexamples.net/index.php?title=CPP/STL/PriorityQueue[/url] As I understand, a heap is the same as a priority queue. Good … | |
Re: You are storing the names as int's which doesn't really make sense. I suggest using a [icode]std::vector<std::string>[/icode]. I suggest breaking your problem into two programs for the moment. One which reads your data, and the other which sorts a list of names. 1) For the input, checkout these examples: [url]http://programmingexamples.net/index.php?title=CPP/IO/ReadingLines[/url] … | |
Re: Can you please elaborate/clarify? | |
Re: You need to overload the '<<' operator. There is an example of this here: [url]http://programmingexamples.net/index.php?title=CPP/OverloadOperator[/url] | |
Re: What does this function have to do with linked lists? It looks to me like that simply inputs a string, followed by an int, followed by a char, followed by a double and then displays them. What is it supposed to do? | |
Re: I suggest coming up with a very simple test case. Then you can compare the behavior to the expected behavior and hopefully track down your problem. If you still can't find the problem, you will be able to ask here with much more information of what is going wrong. | |
Re: Please use code tags when posting code. As far as the compiler is concerned, it is possible that you get to the cout statement [icode]cout << "Average: " << fixed << average << endl;[/icode] without first setting the 'average' variable. That is, you need to either initialize it when you … | |
I have this: [code] int serialInt = 40000359; [/code] but what I really need is this: [code] int serialHex = (int)0x40000359; [/code] What can I do to turn serialInt into serialHex? I found some code that claimed to do this: [code] int IntToHex(int input) { std::stringstream ss; for (int i=2*sizeof(int) … | |
Re: This syntax seems awkward: [code] m2.trans(m2); [/code] If you call the function trans() on an object, it shouldn't take any parameters and it should return void: [code] m2.trans(); [/code] Only if you called the function as a static function would take seem right: [code] m2 = trans(m1); [/code] Also, if … | |
Re: Can you explain what you are trying to do a bit more. I ran the program and didn't understand what I was trying to do. Looking at the code, you read 4 colors from the command line, then you try to compare the input colors to the ordered list of … | |
Re: I encourage you (or someone else) to put a simple TCPSocket example here: [url]http://programmingexamples.net/index.php?title=CPP/TCPSocket[/url] then we can address your specific problem. You say "every thread to do something else". Does that mean you want different functionalities for specific clients? I'd say there has to be some finite set of client … | |
Re: Please use code tags when posting code. What is the problem? Please provide a sample input, the current output, and the expected output. I also suggest decoupling your file input from your algorithm. Hard code some values and make sure the statistics code works first before introducing another challenge of … | |
Re: You'll probably have much better luck finding a forum dealing with serial communication in C - on a c++ forum I wouldn't expect many answers :( | |
Re: Please explain the draw condition and errors that you hope to check for in a paragraph form. Then convert this to pseudo code. Then you can write real functions. Also, I would probably store the board as a [icode] std::vector<std::vector< char > > [/icode] so the squares can be accessed … | |
Re: You may have better luck looking for a Visual Studio forum as this is just a general c++ forum. | |
Re: You're going to have to show us that you have tried before you will get any help. What exactly are you struggling with? I'd suggest breaking it down into little pieces. At first, simple, short stand alone programs, which you then convert into function in your actual program. | |
Re: When in doubt, you should always remove the user input stuff. There is nothing wrong with your use of the Movie vector (except the name - you should call the vector Movies and the individual movie Movie, not M1 and M2): [code] #include <iostream> #include <string> #include <vector> using namespace … | |
Re: I would definitely suggest using a [icode] std::vector<std::string>[/icode] to store the player names. Also, if you hard code an example input that will eliminate one source of errors (the input). It will also let us copy/paste/compile/run your code to help you find the problems. It is much harder when you … | |
Re: Please use code tags when posting code. The way you are accessing it with [icode] temp->key;[/icode] indeed requires key to be a public member. Nested classes don't get any special privileged (i.e. just because you have defined a class inside of a class doesn't mean it gets access to the … | |
Re: If you're looking for a basic example of pthreads, this shows how to create a thread: [url]http://programmingexamples.net/index.php?title=CPP/PThreads[/url] If anyone can make that example more informative, that would be great! David | |
Re: Your structs look fine. I suggest hard coding some inputs so you can show us an example input, the output it produces, and tell us the output you would expect it to produce. David | |
Re: This is the important line: [code] test.c:1:19: error: fstream: No such file or directory [/code] It means your system is not setup correctly. I would try [code] sudo yum install glibc* gcc* libc* [/code] and then see how it goes. David | |
I have a style: [code] .title1 { color: #0000BB; font-size: 25pt; text-align: center; } [/code] but when I use it with: [code] <span class="title1">Schenectady Section of the IEEE More Words</span> [/code] it doesn't center the text! You can see this behavior here: [url]http://ewh.ieee.org/r1/schenectady/New/[/url] Surely I am just doing something silly... … | |
Re: I think this question is better posed here: [url]http://www.opengl.org/discussion_boards/[/url] | |
I have two pages, header.php and sidebar.php which I want to include on several pages using: [code] <?php include 'header.php'; ?> <?php include 'sidebar.php'; ?> [/code] However, there are two different issues. On this page [url]http://ewh.ieee.org/r1/schenectady/New/index.php[/url] , the included text is put BELOW the text on index.php, even thought it … | |
Currently at the top of every page I have this: [code] <HTML> <HEAD> <TITLE>Schenectady Section of the IEEE</TITLE> <META NAME='url' CONTENT='http://www.ewh.ieee.org/r1/schenectady/'> <META NAME='author' CONTENT='Authorname'> <META NAME='email' CONTENT='author email'> <META NAME='expires' CONTENT=''> <META NAME='revision-date' CONTENT='6-Sep-1999'> <META NAME='keywords' CONTENT='Schenectady Section'> <META NAME='description' CONTENT='Schenectady Section of the IEEE'> </HEAD> [/code] If I move … | |
Re: You'll have to elaborate. You just want a video? Or you want code to open a 3D data file and produce a video of it rotating? This is definitely a fairly complex task, so you'll have to specify your operating system, which graphics library you want to use (OpenGL, I'd … | |
Re: That should show you exactly how it works :) If you don't follow it, break it up into smaller statements: [icode]int m=n=j++ + j++; [/icode] If you have specific questions let us know. David | |
Re: It runs fine for me. I just had to change two things where you had 'const' twice: [code] int SortedType::GetLength() const const [/code] to [code] int SortedType::GetLength() const [/code] Can anyone else produce sharifyboy7's problem? | |
Re: Which if statement? If you could make the smallest compilable example that demonstrates the problem and tell is exactly what is happening and what you would expect to happen, that would be very helpful. | |
Re: It looks fine to me. I removed the user input for easier testing and gave two test cases: [code] #include <iostream> #include <stdexcept> #include <exception> using namespace std; using std::runtime_error; int main(int argc, char* argv[]) { int totalPay = 0; //int hours = 0; // throws exception int hours = … | |
Re: I don't follow you. You say you run it and it work, but then you say you run it and it crashes? | |
Re: Here is an example: [url]http://programmingexamples.net/index.php?title=CPP/Sockets[/url] | |
Re: Please use code tags to post code. Also, did you try it? I suggest hard coding the input. Then show us the output and tell us the expected output. David | |
Re: It looks like you never set grid[row][column] to true in the uncommented portion of the code. Also, can you explain the expected output? Now (maybe related to my last statement), I see nothing output (after commenting the "test first loop" type statements. This leads me to believe that grid[i][j] is … |
The End.