No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
interested in c++ last year already, but just start learning this year(for the sake of helping with family's financial problem)I'm 16 btw...from Malaysia,I just hope I can learn c++ fast until my skill can be useful and everyone's help from forum is…
- Interests
- - Anime- Mathematics- Physic- Music; rock, heavy metal, pop, jazz, classic.- Instrument; Piano, Vocaloid(singing…
43 Posted Topics
[Click Here](http://s27.postimg.org/syqganxir/New_Bitmap_Image.png) "Having a container of pointers raises the question of how to destroy it. If you simply "do the right thing" and define a FilmList destructor that visits each of its pointers and deletes it, you must then worry about client code that contains a function with a FilmList … | |
[Click Here](http://s8.postimg.org/ab4paaq8l/New_Bitmap_Image.png) is adding m_y, m_m, m_d, considered as cheating? if not, how to get the value for getYMD()'s param? | |
the program is about Blob<T>, where shared_ptr<std::vector<T> > as its data members. be noted that the real problem here is about shared_ptr of my own version (simple one) but atleast (should) worked with the Blob<T>, which is the std::shared_ptr did, but not with mine. [Error Msg](http://postimg.org/image/krwflmyhx/) the error msg above … | |
[program error](http://s11.postimg.org/okbmkhwkj/Untitled.png) this code, which is directly copypaste from the book itself, is appended to Blob.h., producing the above error. template <class> struct std::hash; class Sales_data { friend struct std::hash<Sales_data>; // other members }; // specialization namespace std{ template <> struct hash<Sales_data> { typedef size_t result_type; typedef Sales_data argument_type; size_t … | |
#include <iostream> template <unsigned, unsigned> class Screen; template <unsigned H, unsigned W> std::ostream& operator<<(std::ostream&, const Screen<H, W>&); template <unsigned H, unsigned W> std::istream& operator>>(std::istream&, const Screen<H, W>&); template <unsigned H, unsigned W> class Screen { friend std::ostream& operator<<<H, W> (std::ostream&, const Screen<H, W>&); friend std::istream& operator>><H, W> (std::istream&, const Screen<H, … | |
void StrVec::free() { if (elements) { for_each(elements, first_free, [this] (std::string* p) { alloc.destroy(p); }); alloc.deallocate(elements, cap - elements); } } produced this error: [Cruel Error :(](http://s3.postimg.org/4p1vfhs9f/New_Bitmap_Image.png) it was the second compiling error, if I removed the pointer, it will produced the first one. which is kind of -.-" so, I … | |
main.cpp // Give your class a < operator and define a vector of HasPtrs. Give that vector // some element and then sort the vector. std::vector<HasPtr> vecHP; std::string val; while (std::cin >> val) { HasPtr temp(val); vecHP.push_back(temp); } std::sort(vecHP.begin(), vecHP.end()); HasPtr.h bool operator<(const HasPtr& rhs) { return (*this->ps < *rhs.ps); … | |
My friend and I tried to create a team of programmers for doing bunch of work, our main aim is the gaming sector (probably). It was said around the net that it was hard work. So, we decided to plan it from now. I got around 1-3 years(blurry because I'm … | |
for (std::size_t iter = 0; iter != m_queryMap.size(); ++iter) { // note here, line = iter + 1; std::set<std::size_t> lineBuck; lineBuck.insert(iter + 1); const std::vector<std::string> &bucket = m_queryMap.at(lineBuck); } where std::map<std::set<std::size_t>, std::vector<std::string> > m_queryMap; // storing each line of input // crossed with the line number as its key yup, … | |
Re: get your compiler and change some variable, like the value of N1/N2, make N1+0 or just anything, after a while. u can learn the algorithm by yourself. | |
error: [Click Here](http://s27.postimg.org/syfgdiagz/New_Bitmap_Image.png) snippet from main.cpp: std::ifstream inFile; inFile.open ("in.txt"); TextQuery(inFile); inFile.close(); snippet from TextQuery.cpp: TextQuery::TextQuery(std::ifstream &in) { std::size_t countLine = 0; std::set<std::size_t> bucket; std::string line; while (in >> line) { m_wordStore.push_back(line); ++countLine; bucket.insert(countLine); m_queryMap[bucket] = m_wordStore; } } been trying to use std::cin to replace it as input feature … | |
http://s11.postimg.org/kxl3cemw3/error.png this is the least error that I can get from multiple time of debugging. [TheCodeFile](http://www.fast-files.com/getfile.aspx?file=70535) StrBlob.h has needed to use something from StrBlobPtr.h and StrBlobPtr.h needed to use something from StrBlob.h I did tried to #include each file on each other respectively, but ofcourse that would be a data … | |
isShorter(const string &s1, const string &s2) { return s1.size() < s2.size(); } stable_sort(ret.begin(), ret.end(), isShorter); either using stable_sort or sort the result is shown in the attachment. meanwhile: "By calling stable_sort, we can maintain alphabetical order among those elements that have the same length:" - C++ Primer 5th edi. which … | |
http://s8.postimg.org/zbfc0h92t/New_Bitmap_Image.png 'contents' can't be initialized whatever I did, thus I can't declare the type in this class class Window_mgr { public: // location ID for each screen on the window typedef std::vector<Screen>::size_type ScreenIndex; // reset the Screen at the given position to all blanks void clear(ScreenIndex); private: std::vector<Screen> screens{ Screen … | |
The combine function been bug since yesterday. Been trying everything back then, define in the source file, remove some code to prevent overlapping definition, etc... I don't know what I should do, can anyone help on this? #ifndef SALES_DATA #define SALES_DATA #include <iostream> struct Sales_data { // new members: operations … | |
// 9-2. If we define the name function as a plain, nonconst member // function, what other functions in our system must change and why? based on the question, the answer would be // answer bool compare(const Student_info&, const Student_info&); // because this function uses the member function as it's … | |
this is what the question said. // 9-1. Reimplement the Student_info class so that it calculates the // final grade when reading the student's record, and stores that grade // in the object. Reimplement the grade function to use this // precomputed value. this is what I thought! 1. Reimplement … | |
[Click Here](http://s16.postimg.org/rjkqfahp1/faulty1.png) I thought after the function call of gen_aux before the loop, the static call on the type for r should have make it declared. but why not? how static really works? this is what it's explained in the books:- static type variable; For local declarations, declares variable with … | |
map<string, vector<int> > // 42 xref(istream& in, // 43 vector<string> find_words(const string&) = split) // 44 error: [errorPic](http://s13.postimg.org/3y4vgjdev/compiler_error1.png) this is a cross-ref program that's written in the book, the exercise told me to create an improved feature for it. So, before I start with my work, I need to organise … | |
not working: // range for for (int (*row)[4] : ia) { for (int col : *row) cout << col << " "; cout << endl; } // error: cannot convert 'int*' to 'int (*)[4]' in initialization. working: // range for for (int (&row)[4] : ia) { for (int col : … | |
[Pictures](http://s10.postimage.org/v28zknfu1/Untitled5.png) I googled and found the solution [Solution](http://stackoverflow.com/questions/4702732/the-program-cant-start-because-libgcc-s-dw2-1-dll-is-missing) but I'm nub sooo, what is compiler flag? how to set it up? there multiple choice, so where should I start? Or should I just switch to IDE(Code::Blocks), the C++ Primer recommend me to use command-line interface compiler and compile it 'manually'. … | |
[Pictures](http://postimage.org/image/qnqrsvenn/) the picture explain it all. | |
#include "splitzer.h" using namespace std; // find all the lines that refer to each word in the input map<string, vector<int> > xref(istream& in, vector<string> find_words(const string&) = split) { funtion body; } error: line 3, expected initializer before using error: line 6, expected constructor, destructor, or type conversion before "<" … | |
if (__comp(__a, __b)) this is the error referred to the file above. basically, it's just about this question : 5-6. Rewrite the extract_fails function from §5.1.1/77 so that instead of erasing each failing student from the input vector v, it copies the records for the passing students to the beginning … | |
this is an unusual error, but maybe if the code presented here it's easier to recognize?! void sLetter(Word_store& s) { for ((s.words_input)::iterator it = (s.words_input).begin(); it != (s.words_input).end(); ++it) tolower(*it); (s.sWords).push_back(s.words_input); return; } the function is aim to converting each character in a string from a member of Word_store into … | |
Hey guys, probably no programming for a long time (around 3 days), I lost myself on this, the `dent_space1(max_space1, ' ')` just not compiling, for its format. if so, how can I 'delete space' for the sake of this task? 4-2. Write a program to calculate the squares of int … | |
[Link Anchor Text](http://s7.postimage.org/wdzzqzst7/weird_error.png) I click yes, thought so, this never popup when I'm compile any file before. [Link Anchor Text](http://s14.postimage.org/6bhslq23l/weird_error2.png) can anyone explain what I'm doing wrong here, I mean, I just copied all the code given in the book (Accelerated C++), then try to compile, but fail. help? =(. | |
what's the problem? E:\Tools\Programming\C++ Programming\CodeBlocks\Project\Knowledge_Based_Project\Exercise_Temporary_Compiler\Exercise_Temporary_3\main.cpp||In function 'int main()':| E:\Tools\Programming\C++ Programming\CodeBlocks\Project\Knowledge_Based_Project\Exercise_Temporary_Compiler\Exercise_Temporary_3\main.cpp|36|error: invalid use of member (did you forget the '&' ?)| ||=== Build finished: 1 errors, 0 warnings ===| [CODE] #include <algorithm> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; int main() { // informed user cout << … | |
in coding, how do you actually track down the bug??? example this code where we want to find the quartile.... ignore the "odd" part, not done on there yet, but the even part just successfully running but produce no result after input (0, random huge number, and another 0) [CODE]#include … | |
hey guys, k, already 1 month I'm "leaving" my self-study on C++ for certain personal reason, I just learned the C++ two months before also, not much... I still can type in code and remember how most of the keyword works(that I learned), but I'm losing my ability to "think … | |
Ok, here I come with a some sort of big analysis with pointer, array, vector, iterator and address of memory... using this input: [CODE] // hakim makan nasi // ayam yang basi // sambil tengok // hafiz yang tergelak // gelak [/CODE] with this code: [CODE] #include <cstring> #include <iostream> … | |
Hi guys, again, coming to this forum for asking some confirmation of my knowledge confusion. firstly, let's take a look on the code:- [CODE] #include <iostream> using std::cout; using std::endl; int main() { // main process const int value_1 = 1000; const int *pointer_1 = &value_1; const int **pointer_2 = … | |
these code, I expect they work the same. using Code::Blocks as the compiler, the result is differ result = output 10 return 0 [CODE] #include <iostream> int main() { int i = 0; while(i < 10) ++i; std::cout << i << std::endl; } [/CODE] result = compile error. [CODE] #include … | |
4-6. Rewrite the Student_info structure to calculate the grades immediately and store only the final grade. What I proceed:- I doubt that data structure can 'hold' function or expression, so I give a look on net to check out, it seems, the tutorial(on net) just show that structure used for … | |
what I mean by undefined error is because I don't know what the error is about. :P, actually it's because the error not from the code itself, but it's about a compiler that can't defined some sort of file... btw, as title said, the error is from the code in … | |
these one code, from line [63-71] of the original code [CODE] // for adding more students cout << endl << "Want to add more student?(yes/no): "; string add_student; cin >> add_student; if(add_student == "yes") { student_counter = 0; } [/CODE] the program seems "doesn't detect" the cin code above, it … | |
hope anyone can help something with this code, well this code for the exercise 3.4 in Accelerated C++ book... where 3-4. Write a program to report the length of the longest and shortest string in its input. I thought my code was gonna going good, but it seems that it … | |
what I mean is from this code, when coder doesn't put any curly bracket({,}), what does the while loop scope will cover? already test with random bracket put on the code, but, the only "brackected code" that work the same as the original code is when I put around words.push_back(word); … | |
can anyone tell me particular code that work opposite way for "sort", where.... [QUOTE] sort(b, e) Rearranges the elements defined by the range [b, e) into nondecreasing order. Defined in <algorithm>. [/QUOTE] from Accelerated C++ | |
Hi guys/girls, I'm Hakim, interested in c++ last year already, but just start learning this year(for the sake of helping with family's financial problem) I'm 16 btw... from Malaysia, I just hope I can learn c++ fast until my skill can be useful and everyone's help from forum is very … | |
the program behaviour is different with code that have similar function this [CODE] #include <iostream> #include <string> int main() { int a = 1; while (a < 11) { int b = a++; int c = a * b; std::cout << c << std::endl; ++a; } return 0; } /* … | |
2-4. The framing program writes the mostly blank lines that separate the borders from the greeting one character at a time. Change the program so that it writes all the spaces needed in a single output expression. already google this, but what I got is a bunch of headache... so, … | |
this code is for bring an output of "Hello, [name]!" with frame on its outside. [CODE]//ask for a person's name, and generated a frame greeting. #include <iostream> #include <string> // say what standard-library names we use using std::cin; using std::endl; using std::cout; using std::string; int main() { // ask for … |
The End.