98 Posted Topics
Re: Use either valgrind or gdb for finding errors. compile with -g option then [code] gdb ./yourprog run [/code] or valgrind ./yourprog | |
Re: I'm using unix, so I can't look at your source files, but theres something I don't understand in you code for case2 Your are setting temp->next = null; which probly mean that you want temp->next->next to be deleted instead of temp. But your should do it before you set the … | |
Re: Hi, I had som difficulties understanding what you wanted but I think I got it now. You want draw a star with an uneven number of points using stdoutput? Do you use some special algorithm for drawing the star, or is that your problem? | |
Re: If you are using 64 linux, then your long ints are 8 bytes. Not sometimes 4,5,6,7 but always 8. The max mapped memory for 32bit is 2^32 around 4 gig The max mapped memory for 64bit is 2^64 around 1.6 million terabytes (this means alot!). The unsigned integer range for … | |
Re: emacs if i'm going to code for more than 5 minutes otherwise vim. sometimes I'm using emacs with speedbar and gud mode. But mostly I'm sitting in a term over ssh, so 90% of the time I'm using emacs with the -nw option. I would really like to use vim … | |
Re: I still don't understand what the question is ;) | |
Re: [QUOTE=Takafoo;821851]I don't really understand the concept of a prime number or how to calculate it sorry.[/QUOTE] Then you should ask in a mathforum and not a c++ programmer forum. A prime number is a number that only has 2 divisors. the number one and the number itself. This means that … | |
Re: It depends on how you matrix is defined as a datastructure. Sometimes they are defined as one long array. Then you can just add the array elementwise. If they are defined as double pointers, then you should loop through the entire matrices in the sameorder. | |
Re: consider using printf and tabs If you really want to use c++ you should look into iomanip [url]http://www.fredosaurus.com/notes-cpp/io/omanipulators.html[/url] printf("1\t2\t3\n"); will be turned into 1 2 3 You shouldn't have to type in the spaces manually | |
Re: I would use modulo and div that is if I want to extract the second digit of 234 I would (234 %100)/10 The first paranthesis, strips out the 2 such that 34 remains this slash 10 then calulates how many timis 10 divides 34 without remainder. | |
Re: [QUOTE=s1986;823558] I gave it as urgent because of the lack of time in my hand.[/QUOTE] I can understand why you call it urgent, when it is urgent for you. But that doesn't make it urgent for me. I don't read every post on the boards I've signed up for, I … | |
Re: On a general note, (anyone correct me if I am wrong). The bool type is part of the c99 standard, and is as such not expected to be as portable. I've never found a use for the bool type that the short int or char couldn't solve. The bool still … | |
Re: I think you need to include cmath and or compile with -lm | |
Re: I wouldnt bother with the exponent. I would only use the coefficient and let the position in an "Array" be the exponent. Exponents are by definition integers >0 , so it should be ideally suited for a simple array. the polynomial [TEX]a Z^4 -b Z^3+cZ+7[/TEX] the last term has an … | |
Re: Hi i am the original poster from the other thread referenced to you. It's very difficult to get decent information, I have actually been reading a oldstyle book, to understand this. If you just want it to work do as stuxyz told me. On a deeper level, I think partial … | |
I'm having troubles linking together different classes that uses the same templated class. I found 2 workarounds, that will make it compile, but it's not really a solution. 1. don't do a staged compiling with linking object code 2. inlining the spezialized member functions. I'm looking for a solution that … | |
Re: [QUOTE=William Hemsworth;818427] If you can't do something like this, try using [URL="http://www.cplusplus.com/reference/clibrary/cstring/strtok.html"]strtok[/URL], it will help you split up the word using a delimiter. Hope this helps.[/QUOTE] Yes a tokenizer is highly recommended. You will end up using it in half you projects. | |
Re: you should try compiling each of the files into object code, something like g++ -c yourfile.cpp This should check if your compiler is workings, not the crosscompilation linker and all that stuff. To salem. you can compile headers, these are called .pch og h.gch stdafx on visual studio is an … | |
Re: Without having looked to much on your code, I would simply shadow the "numberofpayments" variabel in a greater scope, and print out the outputline after the main while loop | |
Re: So it's a minimum spanning tree right? if so use either kruskall or prim [url]http://www.boost.org/doc/libs/1_38_0/libs/graph/doc/index.html[/url] But don't bother with the implementation just use boost. | |
Re: I had a program where I need to read in data, I ended up tokenizing each line and looping while(!.eof()) | |
Re: [QUOTE=Mossiah;816401]Please help me with this. I am a newbie at this. I am supposed to pass a string array to a function. Letter grade Please give me an example on how to do it plz. thanks in advance.[/QUOTE] What do you mean, an array of strings? og just a string … | |
Hey, does anyone know if it possible to have something like [CODE] #DEFINE NUM_DEC 4 printf("This is your value:%.NUM_DECf\n"); [/CODE] thanks in advance | |
Hi, I've written a program for statistic analysis that can be found here [url]http://staff.pubhealth.ku.dk/~ande/web/software/relate.html[/url] I want to make it portable and the program works on unix with the following compilers sun, intel and gcc It also compiles on windows with mingw and the intel compiler. I've installed ms studio, but … | |
Hi, I was just wondering if adding debug symbols to my program, will slow down it's performance. I'm running linux. thanks in advance | |
Hi I'm trying to convert a linux/gcc program to windows/cl But I'm having some problems understanding the inner workings of the ide called microsoft visual studio c++ 2008 express. I've started a "new clr project", and then added the .hpp file, that contains the header. But the compiler/f7 says that … | |
Hi, I was thinking about implementing piping and redirection in some of my programs. But I'm having difficilties getting started. Does anyone know were to read up on this area, or just what to google. Google only gives my tutorials on basic unix commandline usage. thanks in advance | |
I've made a program using gcc as a compiler. In my loops I've been using a uint type as the type of my loop variable. But now it seems that some systems doesn't support this type. Can I make a preprocessor conditional that does a #define uint to unsigned int … | |
I wan't use the multimap on my own templated class. The following is a working example with a builtin type. [CODE=c++] int dat[5] = {0,6,3,7,3}; typedef std::multimap< int, int > asso; asso dict; for (int i=0;i<5;i++){ dict.insert(make_pair(dat[i],i)); } asso::iterator pos; for(pos=dict.begin(); pos!=dict.end() ;pos++) cout << pos->first <<" next "<< pos->second … | |
Re: Whats your error message? are you using namespace std otherwise string should be std::string | |
I've been overloading some methods for a template class. This means I can write my code in this way. [CODE=c++] myClass var3=var2+4; [/CODE] Is it possible to do it the otherway around like [CODE=c++] myClass var3=4+var2; [/CODE] I know that the end result will be the same, I was just … | |
Hi, I've been implementing my own array class, and I've finally started to use it. I do have one question, [CODE=c++] Array<int> ary1(3);ary1(0)=2;ary1(1)=4;ary1(2)=7; //just an array Array<int> ary2(3);ary2(0)=1;ary2(1)=2;ary2(2)=6; //just an array cout << ary1; cout << ary2; Array<int> ary3 = ary1+ary2; cout << ary3; //everything till this point works //is … | |
Hi I'm doing a templated matrix class, and I'd like to be able to pass a function pointer to a function that uses the rows. [CODE=c++] template<typename T> T sum(Array<T> &a){ // a simple function that return the sum of an Array T res=0; for(int i=0;i<a.length();i++) res+=a(i); return res; } … | |
I'm doing my own array template version of an array. I'm having some problems overloading a method. I'm doing a specifik version of a "print()" if the type of array is <char>,(i'm saving bools as char). this works without problems. I just needed to add a templete<> infront of my … | |
Re: I depends on the version of mpi, the scheduler and most of all how the admin has setup the system. If the admin is you, then you might have to setup a small script. I did the following when I installed mpi. my version of mpi used a list of … | |
Hi, I'm doing a low-mem implementation of a matrix, than can contain values from 0-4, this is fine for my program. I input 4 values (each 2bit) into 1 char(8bit). I'm using bitpatterns and shifting to extract values. But this is of cause hidden from the user. I've done everything … | |
Hi, I've been programming a lot of c code, and now I'm trying to set my mind into the c++ way of doing things. so I'm trying to avoid pointers, and use refs instead. As far as I understand pointers are to be avoided using stl's for instance. I have … | |
Re: [QUOTE=inkcoder;685742]Hey everyone, still learning c++ I had a question. How do I create an array that will hold strings of text. such as: ??? map[10]; map[1]= "text"; map[2] = "text2"; map[10] = "text3"; cout<< map[1] "\n"; help would be great ink[/QUOTE] You can do it in many different ways, but … | |
Re: I don't really understand what your doing here, this has nothing to do with linked lists. you need to do use a struct like typedef struct lnode { int data; struct lnode *next; } listnode_t; | |
Hi I have a some general questions, some are c others are c++ related. So I'll just post them here in the c++ forum. These question only relates to speed not so much design issues. So far most of my programming has just been about making it work. That is … | |
Re: I don't really understand what you want. Strings(c++) and chararrays(c) can be arbitrarily long. So do you want a datastructure to hold an infinite amount of different strings? You need to elaborate on your problem | |
Re: Can you elaborate on your problem. Given the subject of your post, I thought you had problems opening a file in your code. But it seems there are no file input/output. Can you compile the code, and if you can't compile what is the error message. | |
Hi, given a char(8bit's), I want to get the value of every 2bits, so that a char will contain 4 values. This is easily done with a shift left command (<<2). As far as I understand, char arrays are simply the different chars in consecutive order in the memory. so … | |
Re: If you are new to the parallel way of doing things, I wouldn't start with MPI. You should start with simple threading. And pthreads are installed by default, and has quite good documentation. good luck | |
Re: What was wrong with gsl? What do you want to optimize, is it a maximization/minimization you want. Or is it a linear programming problem. I've use it for maximization problems, and found it strange that I needed to supply a, gradient function, and also use special gsl vectors. But other … | |
Hi I'm doing a statistical mcmc model where I need some random numbers. I decided to use the ranrot-w generator. The random number only works when I call the randomnumber method directly, and not when i give the random number as an parameter to another function. that is rg.Random() !=random(rg) … |
The End.