98 Posted Topics

Member Avatar for azStudent

Use either valgrind or gdb for finding errors. compile with -g option then [code] gdb ./yourprog run [/code] or valgrind ./yourprog

Member Avatar for azStudent
0
142
Member Avatar for Avaviel

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 …

Member Avatar for Avaviel
0
114
Member Avatar for winry
Member Avatar for nitu_thakkar

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?

Member Avatar for nitu_thakkar
0
163
Member Avatar for maru2

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 …

Member Avatar for StuXYZ
0
216
Member Avatar for winrawr

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 …

Member Avatar for monkey_king
0
138
Member Avatar for wonder_laptop
Member Avatar for Takafoo

[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 …

Member Avatar for vmanes
0
123
Member Avatar for jenilgandhi

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.

Member Avatar for monkey_king
0
91
Member Avatar for iTsweetie

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

Member Avatar for vmanes
0
137
Member Avatar for Dewey1040

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.

Member Avatar for monkey_king
0
111
Member Avatar for s1986

[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 …

Member Avatar for monkey_king
0
102
Member Avatar for yuvaraj.tr

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 …

Member Avatar for monkey_king
0
130
Member Avatar for WesFox13
Member Avatar for WesFox13
0
91
Member Avatar for thingstealer
Member Avatar for Seapoe

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 …

Member Avatar for monkey_king
0
109
Member Avatar for daviddoria

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 …

Member Avatar for nucleon
0
3K
Member Avatar for monkey_king

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 …

Member Avatar for StuXYZ
0
847
Member Avatar for sunderthomas

[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.

Member Avatar for monkey_king
0
165
Member Avatar for Crul

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 …

Member Avatar for Salem
0
1K
Member Avatar for 94SupraTT

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

Member Avatar for tux4life
0
79
Member Avatar for mimis

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.

Member Avatar for mimis
0
371
Member Avatar for homeryansta

I had a program where I need to read in data, I ended up tokenizing each line and looping while(!.eof())

Member Avatar for DemonGal711
0
297
Member Avatar for Mossiah

[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 …

Member Avatar for monkey_king
0
66
Member Avatar for monkey_king

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

Member Avatar for Prabakar
0
98
Member Avatar for monkey_king

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 …

Member Avatar for Nick Evan
0
104
Member Avatar for monkey_king

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

Member Avatar for daviddoria
0
89
Member Avatar for monkey_king

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 …

Member Avatar for iDeveloper
0
230
Member Avatar for monkey_king

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

Member Avatar for monkey_king
0
82
Member Avatar for monkey_king

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 …

Member Avatar for WaltP
0
158
Member Avatar for monkey_king

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 …

Member Avatar for monkey_king
0
188
Member Avatar for launic

Whats your error message? are you using namespace std otherwise string should be std::string

Member Avatar for launic
0
158
Member Avatar for monkey_king

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 …

Member Avatar for monkey_king
0
149
Member Avatar for monkey_king

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 …

Member Avatar for dougy83
0
93
Member Avatar for monkey_king

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; } …

Member Avatar for monkey_king
0
8K
Member Avatar for monkey_king

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 …

Member Avatar for monkey_king
0
112
Member Avatar for Ninabox

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 …

Member Avatar for Ninabox
0
118
Member Avatar for monkey_king

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 …

Member Avatar for ArkM
0
224
Member Avatar for monkey_king

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 …

Member Avatar for ArkM
0
117
Member Avatar for inkcoder

[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 …

Member Avatar for Lerner
0
118
Member Avatar for kishore84

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;

Member Avatar for ArkM
0
150
Member Avatar for monkey_king

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 …

Member Avatar for Narue
0
151
Member Avatar for vijaysoft1

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

Member Avatar for raul15791
0
140
Member Avatar for PuQimX

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.

Member Avatar for Aia
0
127
Member Avatar for monkey_king

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 …

Member Avatar for monkey_king
0
2K
Member Avatar for Ninabox

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

Member Avatar for Ninabox
0
122
Member Avatar for daviddoria

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 …

Member Avatar for daviddoria
0
155
Member Avatar for monkey_king

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) …

Member Avatar for monkey_king
0
156

The End.