611 Posted Topics
Re: Work on code readability mate. format your code well then repost ok? | |
Re: And if i were you, i will bring in the class object inside the main. Then the initialize fucntion a template so that you can use that for both class. template<class T, int size> void init(T, size){ // Then you can initialize all you class } | |
Re: As deceptikon has explained earlier, I also wish to add something further to it. `*(0+a)` is equal to calling `*a` or `a[0]`. when you add the ofset data to the pointer` *(2+a)` , you just ask the pointer to move to the said memory space then defference the pointer with … | |
Re: Thats very simple and easy. wow... so simple task. But no one willdo that here for you. oooch! So if you want our attention.... then show some code will you? | |
Re: counted_ptr must be a template/generic type which is well designed. template<class T> count_ptr{ count_ptr():t(tp){} operator()(){} operator +(){} operator=(){} private: T t; }; int main(){ //class foo object bar foo bar; // now count_ptr serves as a container that can accept and manipulate class //foo objects. count_ptr<bar> count_ptr_bar. } get back … | |
Re: If you need more info about linux .so link. Get back for that ok? The concept is not too different. | |
Re: there are various questions that comes to mind. 1. how was the main file written? ie. is it encrypted ? -if yes, you will need the encrypted key/pass to get the real data. - if no, then you must know how to use the compressed lib verywell to use it … | |
Re: Your problem is number 12 in the while loop. The logic was not right. try this string data; static int count=0; while(getline(d_file,line)){ data +=line; count++; if(count==2){ user_vec.push_back(data); count=0; } } you caould have had the data setup the way you want before inserting into the vector. Its called planning. | |
Re: printer is a very low-level stuff. there are hundreds of libs out there but you must consider a GUI like QT thats a multi platform. The best GUI in town. | |
Re: start with some googling ok? Here we do not teach people but we share ideas. Its a give and take show. not take take ok? come again when you want to comply. Thank you. | |
Re: help yourself. ofstream fw("foo.txt"); fw<<"write me "<<endl; fw.close(); | |
Re: What is the error output. can you post that here also? | |
Re: Your code runs without error on my ubuntu Qt5.1. Can you post your error? | |
Re: lambda is also another way out. consider looking into that. I personally like lambda when it comes to what you are requesting. Clean and mmm simple. That is depends on your knowledge with cpp11. | |
Re: online 43. set up a static int counter =0; then increment the counter in the while loop . check with if the counter is equall 3 break or else keep asking for the password to be entered correctly. simple. | |
Re: so what have you done personally here. Do something, show your errors and we might/may help you. Thats how we do it over here. | |
Re: Also i guess you need to look into recursive fucntion as you could accomplish this task easy with that. i hate long codes. it makes me wanna sleep. long codes are more error prone. | |
Re: Also consider xml type as its more structured. Thats depending on your level lol. My favorit here is sqlite but i guess you wont need that for now. Experiment.... keep on. | |
Re: No one will go the those link for you. Provide your code and your errors and we might have a look at them. we dont get paid for anything here... remember that. | |
Re: Asigning array of the same data type which is bigger copies the data. so i think its more efficient this way. nt *exp(int *,int); int main(){ int ar[]={4,3,7,5,7,8,6,5,4,2}; int *foo; foo = exp(ar,10); for_each(foo,foo+10,[](int &c){ cout <<c<<endl;}); return 0; } int *exp(int *arr, int size){ int *temp=new int(size*2); temp = … | |
Re: int main(){ std::fuction<void(const &a,void)>pp =&a::message(); pp(); return 0; } you need to write your class well. look into it more cpp0x help on fuctional. | |
Re: You need to run your pointer in a loop and randomly insert NULL. pseudo code... for(n=0;n<10;n++) for(y=0;y<10;y++} if(y%2==0) p[y][x]=NULL; p[y][x]=y+x; Hope this help. | |
Re: should be a pratice to always use int main(). Main in cpp is not void. With your args, i think you are not entering it right or some other stuff you are not doing it right. | |
Re: The code seems too much C style to me. why couldnt you just use a proper CPP style. And could even make it 3 lines once you get the idea. ifstream file("text.txt"); //open file string stuff,cc; if(file.is_open()){ // check file if success while(!file.eof()){ file >> stuff; // put line date … | |
Re: Open your file before the do statement on number 27. You keep opening file which is already open.. That can truncat data and most compilers will give fatal error. Its not done. put it ouside the loop. Also use `string ans = ifFile.is_open()?" file open ":"Error";` Not specifially this style … | |
Re: your code is even more error prone. memory leaks. new allocation always need to be freed. On line 16. for something simple like this, there was no need using new alloc. just simple const int foo=10; int afoo[foo]; something more simpler and effective for basic data ops. The point is … | |
Re: Guys looking at the post carefully, the poster's code is still not answered. He wanted to print a linklist data and then delete the last node. looking at his print function, it looks like he was trying to build a doubly link list not a single list. This is why … | |
Re: maybe he needs a const char* just to print it out. what else ?.... can we both agree that he should get back to basic oop and data types classroom again. just my opinion. | |
Re: Try this style. Also you can read the value into an array or just cout. Its even more easier once you know that value format remains the same. using namespaces std; string line = "foo: bar: boo:tuna"; string del = ":"; size_t pos = 0; string token; while ((pos = … | |
![]() | Re: MixedExpression.cpp. Look at line 94 bout printdata method. The logic is not right. You seem to read data to out output file object but not printing to screen. check your logic and debug well. |
Re: A dongling pointer. This is C++ not VB or Javascript... no var variable here please. | |
Re: I think the speed of new releases of python is not a good idea. Python have so many releases and they break things. GUI's like [B]wx,QT,GTK [/B]cant keep up with this mess. I know tk is there. But who uses tk for serious stuff.? Why cant they make LTS releases. … | |
| |
Re: check with the bind method name( event handler method). its different to the method name it calls. self.Color is not the same as onColor. | |
Re: you need to put the ode that opens the file in try-except braces. Then open a wxMessagebox inside the catch(exeption) brace. Its been along time i worked with wx but the style and logic is the same on GUI's. try{ open file() } except(msg){ wxMessageBox(values,message,...) } | |
Re: you need to chmod the file. i think is os.chmod(filname,octal value) | |
Re: you need to include ctype header. then once you recieve the input you check with isdegit() method. its a bool method so you do if statement. | |
Re: hay buddy work on this . i have not check it but should work. chunk_val = raw_input("chunk values : ").lower() # values to search check_val = raw_input("check stuff : ").lower() # search values. dont repeat search values. eg values appears once for checking data ={} #dir to keep distinct for … | |
Re: You dont seem to have a 2d array here my friend. 2d array is only col and row. once you name int cols1 and int cols2 then int rows1 and int rows2. You got 4d array. Understand that 2d arrays are rows and cols. no more no less so get … | |
Re: very strange. can you show your code? | |
Re: it is function / method overloading. operator overloading is quiet a different stuff. )) | |
Re: you can sum the value from an array in a very simple style. eg; <?php $value; // Array value contain 40 int; $array_int[39]; // Now sum the stuff; for($value=0;$value < count($array_int);$value++){ // Sum the value from the array $value +=$array_int[$value]; } echo "the Ssum is "; echo $value; ?> ![]() | |
Re: while(inFile.good()){ // read the file content } Thats another way to read file content. listen to vernon... he has given more information than you needed. You can also get the size of the file and read the content in little chunks. | |
Re: I am thinking of writting a tut about threading and socket. ;) | |
Re: There are 2 thing that may help fix your problem. At least anyone of them is enough for the task. 1.Thread 2.javax swing Timer. 1.if you need thread then you will need to call the runnable method to innitiate the clock. This must be called in an event. 2. If … | |
Re: Can you be kind to yourself and show us some code dear friend? | |
Re: Also you can bring the innitializing of the `int[] values = new int[numbValues];` into the constructor. Object(int numbValues) { values = new int[numbValues]; this.numbValues = numbValues; } but leave the declaration outside . that is `int [] values;' By this you will be fine also. that means you will need … | |
Re: this is a clue... public stack <datatype> foo = new stack<datatype> foo(); public Node <stack> nfoo = new Node<stack> nfoo(); now you can put stack into node. |
The End.