You're right! I tried again and apparently it works as it should with the new algorithm. It didn't work with the above which was why I removed them. Thanks for the help! :)
Type: Posts; User: 843
You're right! I tried again and apparently it works as it should with the new algorithm. It didn't work with the above which was why I removed them. Thanks for the help! :)
Thanks! I implemented a different method, which involves creating a set of new lists with all the letters and words sorted alphabetically, which works.
However, I still can't figure out how to...
I have a word list and a file containing a number of anagrams. These anagrams are words found in the word list. I need to develop an algorithm to find the matching words and produce them in an output...
So that wasn't the problem. I'm confused because the test lines at the bottom still do not work. The strings are not stored correctly:
ifstream cargo_in("cargo_input.txt"); //opens input...
How else can I assign a string to an array?
I'm trying to assign a string to a string array, but I keep getting the 'cannot convert parameter' error. Here's the syntax I'm using:
string data;
string *cargo_name_array;
cargo_name_array =...
You're right, thanks!
I see, thanks!
The following program crashes. Can someone please tell me what's wrong in this code snippet?
int i, n = 0, num;
string data;
string *cargo_name_array;
int *cargo_duration_array;...
Yes, but what's a 'map'?
Sorry, but I don't think that's what I was referring to. The object names are file1, file2, etc. and I want to assign integer values to them, not to print the result.
Let's say I have the objects file1, file2, file3, ... up to file9.
I also have an array file_array[i] for i = 1 to 9 with a value assigned to each element.
How do I assign the array values to the...
I'm having trouble reading from a file with the following format:
John 51021400
Mary 51021411
Steve 51021406
Aaron 51021403
Kim 51021408
For some reason the getline functions do not...
Right, my bad.
I got it! I was modifying the files as standalone files. I have never bothered with project files before, so the thought never crossed my mind.
It's not exactly the same problem, because for this...
It's okay, I just fixed it. Basically, in all the cpp codes I #include the corresponding headers, and in the main.cpp I #include both player.cpp and swordsman.cpp. This is the ONLY way I got the code...
I have the following codes:
main.cpp
#include <iostream>
#include <string>
using namespace std;
#include "player.h"
For instance, here are the functions for player::death and player:isDead as defined in player.cpp:
// report whether character is dead
bool player::death()
{
return playerdeath;
}
//...
main.obj||error LNK2019: unresolved external symbol "public: void __thiscall player::transfer(class player &)" (?transfer@player@@QAEXAAV1@@Z) referenced in function _main|
main.obj||error LNK2019:...
I see, so instead I should have written "ThreeD ptr = new ThreeD()" instead?
Got it to work, thanks!
By the way, is there any difference writing ThreeD() and ThreeD for the object class?
Point is the base class and ThreeD is the derived class. I would like to create a new object dynamically from the derived class via the following code:
int main()
{
Point *ptr = new ThreeD();...
I was supposed to write a friend function, not a friend class. I just reread the assignment.
I see.
Thanks! Got it :)
Thanks!
It's part of the assignment. EDIT: Scratch that, I was supposed to write a function, not a class.
Why?
I've got the following code:
#include <iostream>
#include "Fraction.h"
using namespace std;
class Fraction_dup {
friend class Fraction;
public: