Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

~9K People Reached
Favorite Forums
Favorite Tags
c++ x 48
c x 3
Member Avatar for mitrious

10-4. Write a class that implements a list that holds strings. 10-5. Write a bidirectional iterator for your String_list class. 10-6. Test the class by rewriting the split function to put its output into a String_list. there are theses three exercises in the book I'm studying, what is it asking …

Member Avatar for DinoG
0
429
Member Avatar for mitrious

I have a node class that has a Node* parentNode atribute. My constructor is as follows: [CODE]Node::Node(Node* p,const State& s, int d) : parentNode(p), currentState(s), depth(d){ }[/CODE] BUT with this constructor I get a problem: I'm using this class to run a AI Search and at depth 3 it generates …

Member Avatar for mitrious
0
210
Member Avatar for mitrious

I have a node class that has a pointer to Node indicating its parent Node [CODE] class Node { . . . Node *parentNode; }; [/CODE] I receive a pointer to node in the constructor being the parent Node of the current node being created or a NULL value if …

Member Avatar for deceptikon
0
5K
Member Avatar for mitrious

Here's my problem. I'm trying to write info to a bin file, consider the following piece of code: [CODE]FILE *fp = fopen("banco\\banco.bin", "ab"); char buffer[22]; sprintf(buffer, "55555555 111111 11111"); fwrite(buffer, sizeof(char), 22, fp); fclose(fp);[/CODE] when I run this it writes to the file that line twice when I print it …

Member Avatar for mitrious
0
143
Member Avatar for mitrious

I'm implementing a bi-directional iterator for a class (a simple list that holds strings) ... the book I'm using asked me to do so ... (I'll have to implement a version of the standard list class afterwards) ... but my iterators just won't work... here's what I have my iterator …

Member Avatar for mitrious
0
148
Member Avatar for mitrious

I've implemented a version of the String class (named Str) and I was implementing the getline fucntion of the getline function that's what I got [CODE]void* getline(std::istream& is, Str& s){ s.clear(); char c; if(is){ while(is.get(c)) s.push_back(c); return s.begin(); } return NULL; } [/CODE] I used void* so I would be …

Member Avatar for mitrious
0
352
Member Avatar for mitrious

In the last chapter of my book we implemented a simplified version of the vector class In the chapter I'm studying now we're implementing a simplified version of the string class ... which uses my version of the vector class (called Vec) to hold chars. [CODE]Str(const char* cp) { std::copy(cp, …

Member Avatar for mitrious
0
162
Member Avatar for mitrious

My book asked me to create a simple version of a list that held strings. Here's what I did. [CODE]class String_list{ public: typedef std::string* iterator; typedef std::string* const_iterator; typedef size_t size_type; String_list(){ data = limit = 0; }; String_list(size_type, std::string); size_type size() const{return limit - data;}; bool empty() {return data …

Member Avatar for vijayan121
0
664
Member Avatar for mitrious

given the following code [CODE]bool space(char c) { return isspace(c); } bool not_space(char c) { return !space(c); } template <class Out> void split(const string& str, Out os){ typedef string::const_iterator iter; iter i = str.begin(); while(i != str.end()){ i = find_if(i, str.end(), not_space); iter j = find_if(i, str.end(), space); if(i != …

Member Avatar for mitrious
0
147
Member Avatar for mitrious

In the book I'm studying we are given a function to make rand() work for numbers that are smaller that RAND_MAX [CODE] int nrand(int n){ if(n <= 0 || n > RAND_MAX) throw domain_error("Argument to nrand is out-of-range"); const int bucket_size = RAND_MAX/n; int r; do r = rand()/bucket_size; while(r …

Member Avatar for pseudorandom21
0
1K
Member Avatar for mitrious

Here's what the book asked [B]The implementation of nrand in §7.4.4/135 will not work for arguments greater than RAND_MAX. Usually, this restriction is no problem, because RAND_MAX is often the largest possible integer anyway. Nevertheless, there are implementations under which RAND_MAX is much smaller than the largest possible integer. For …

Member Avatar for mitrious
0
103
Member Avatar for mitrious

I'm studying the Accelerated C++ book in the 7th chapter it teaches how to create random sentences from an input that goes like this words between brackets work as categories and <sentence> is the category that defines how the sentence will be organized example: I enter the lines: <sentence> the …

Member Avatar for mitrious
0
163
Member Avatar for mitrious

The book asks me to do the following: Note that the function from the previous exercise and the functions from §6.2.2/113 and §6.2.3/115 do the same task. Merge these three analysis functions into a single function. the three functions are: [CODE]double average_analysis(const vector<Student_info>& students) { vector<double> grades; transform(students.begin(), students.end(), back_inserter(grades), …

Member Avatar for mitrious
0
134
Member Avatar for mitrious

I'm trying to use the tolower function from the cctype header ... in this function (to check if a word is a palindrome [code=c] int palindrome(const string& w) { typedef string::size_type sz; string ret = w; sz r = 0; sz l = w.size() - 1 ; int check = …

Member Avatar for Narue
0
131
Member Avatar for mitrious

I'm studyign the Accelerated C++ book and I have the MS visual studio 2008 here ... and I also have Ivor Horton's Beginning Visual C++ 2008 ... I was wondering if, after I finish reading Accelerated C++, it's a good idea to use the Ivor Horton's book ... anyone used …

0
56
Member Avatar for mitrious

The execise in the books asks this: Design and implement a program to produce a permuted index. A permuted index is one in which each phrase is indexed by every word in the phrase. And says: A good algorithm is suggested in The AWK Programming Language by Aho, Kernighan, and …

0
66
Member Avatar for mitrious

I wrote these functions and when I call them they're not working ... and I don't know why. here is the code for the functions [code=c]istream& read_notes(istream& in, vector<double>& nt) { if(in){ nt.clear(); double x; while(in, x){ nt.push_back(x); } in.clear(); } return in; } istream& read_info(istream& is, Info& inf) { …

Member Avatar for mitrious
0
175
Member Avatar for mitrious

I created this function(it works if I put all this into the program) but I can't seem to use the value I get there (the size of a string) in my program... how can I call it and use the values I calculated here [code=c]string::size_type ssiz(const vector<string>& sz) { typedef …

0
58
Member Avatar for mitrious

I "miss wrote" the name of the book ... sorry ahhaha accelerated hhahah why did I write advanced ... damn =S ahha 4-2. Write a program to calculate the squares of int values up to 100. The program should write two columns: The first lists the value; the second contains …

Member Avatar for daviddoria
0
141