I have read some STL string. It's very helpful.
Thank you guys alot.
Type: Posts; User: cubimongoloid
I have read some STL string. It's very helpful.
Thank you guys alot.
Thx for the tip, i did it. I know dynamic but not much attention on that.
int size = line.length();
char *str;
str = new char[size+1];
strcpy(str, line.c_str());
Thanks
Sorry, i'm new with c+ so i don't get it.
I did try the size by string.size() and but into chr str[size] but it had error for initialize char str[]
What should i do?
Thx
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
int main()
{
string line = "Today! I'm very-tired "; // if i do like this, the system will hault and...
ive checked cout for w.getCount() it increased, but print out only 1
string toString() const
{
stringstream ss;
ss << " " << count << " | " << s;
return ss.str();
...
in class words i defined string and int for count
class words
{
private:
string s;
int count;
public:
in the increment function: if find() increase else return NULL, is that what u meant?
This is avl bintree. I am not allowed to use map, because this app will be base on bintree. Many ppl also suggest me using map (much easier) but i cannot.
#ifndef BINTREE_H_
#define BINTREE_H_...
Hi all!
sorry, title is using existing template.
I wanna add words into a bintree with count with them. If the word is already existed it will increase 1.
first my words class has 2 variable
...
I have inserted and printed out the bintree (automatically sorted)
but there still one problem
while (fin.good())
{
getline(fin, temp);
I did add the bintree insert outsite the loop. The numNodes() increase but i cannot get the display because: words w(new_word) is inside the loop.
Btw, base on the code above the display go weird....
I did go to this far. I wanna implement istream and ostream to bintree but hvn't known yet.
This is the code by far i have recognized the duplicate word in the tree. I wanna the istream and ostream...
I defined a vector for a word. so when the *itr meet some special symbol, it will finish the vector for a word. For example: Today!. a vector for T o d a y, when *itr see symbol "!" it will terminate...
Thx alot. I will try it.
i have try but still not know that to getline into istream. Most of the example is use cin for istream.
So should i call the cin instead of getline. Because they are at 2 separate function.
...
Should we define in Words class the string and double for the decimal number. Because it also will be read (u can have a look back to the result). i read the book, it said cin on istream will be...
It seems to be stupid but how can i parsing delimiter inside operator>>
stream >> word.s;
and
words w(temp);
the app will read the line then put temp into istream OR istream do the part put...
yes. Just that. That is the template of bintree in the lecture which we may or maynot need to understand (hhaha...:D) but we can still write the code.
This is the first subject about programming...
This is also help us to understand the bintree and implement it into the assignment. which is i have to implement the bintree into my work. The app will read the file with multiple dilimiter in 1...
I understand what u said. The thing here is the lecturer provide bintree.h and binnode.h (his own work so you have to implement it in to your assignment. Because when submit, i can online submit 1...
I fixed them already, now they can read from file, normal.
This is base on bintree work with bintree.h is provided by lecturer. He's so tricky. And i'm not sure that can we used another method as...
That was quick. I'm just a beginner so to understand it i hv to take time. great work.
The typedef map<> is in the library or user define. And i havent study map so, i barely understand it. In...
thx, im reading and thinking about them.
As you can read the post above. there is a file with mixing words and chars. The program will read the file, separate them follow the rules (which is show as result, so hard to explain)
they will...
is it a vector of char???
because i confuse to read by line or by char?