75 Posted Topics

Member Avatar for christian03

What problem are you facing? Post the error that you get. Also please edit your first post by aligning the code properly and wrap [code] tag so that it is easily understandable for us to analyze.

Member Avatar for Lerner
0
226
Member Avatar for Dumb Fish

[QUOTE=Dumb Fish;1749077]hi, i need to ask how to generate the negative answer? i have one formula. But always give me positive answer.. For exmaple: [B]AllocatDiff2 = 100 * -0.05;[/B] hope somebody can help me ...ASAP!! Thanks ...[/QUOTE] is AllocatDiff2 and unsigned int?

Member Avatar for thines01
0
163
Member Avatar for Mxous

How about this??? :cool: [CODE] unsigned int grade_index; unsigned int score = 35; //this is your score. use scanf to get it. grade_index = score/55 + score/65 + score/75 + score/85; char grade = 69; grade = grade - grade_index; printf("%c", grade); [/CODE]

Member Avatar for Mxous
0
135
Member Avatar for subith86

I am trying to implement my own version of BigInteger which can hold an arbitrary big integer. I have posted my BigInteger.h file here and I need your suggestions if there is any better design for this. 1. std::string private member will hold the BigInteger in the form of string. …

Member Avatar for VernonDozier
0
2K
Member Avatar for srinath1

You are passing the pointer by value. And you are swapping the copy of the actual pointers in swap() function. When it comes out from the function, the pointers' copies go out of scope and hence no swap happens. One solution is to pass the pointer by reference. Other solution …

Member Avatar for srinath1
0
115
Member Avatar for ztdep

What I understand from your requirement is that your Swarm object will contain Particle(s). Each Particle has a unique dimension_id. Why can't you use map in Swarm class. A map where the key is dimension_id and value is a Particle object. Please correct me if my understanding of your requirement …

Member Avatar for jaskij
0
96
Member Avatar for rmbrown09
Member Avatar for avenger123321
Member Avatar for lmytilin
Member Avatar for Lerner
0
179
Member Avatar for jigglymig

That didn't look like a circular linked list. Anyway, I made a few corrections and it worked fine. [CODE]void add() { int n; cout << "What is n? "; cin >> n; if (n > 0) { Head = new(node); Head -> Item = n; Last = Head; for (int …

Member Avatar for Lerner
0
105
Member Avatar for Ayzu

1. Line 49 : It should be [CODE]temp1->ptr=temp;[/CODE] 2. Line 67 and 69 : You repeat the same statement. Delete both the lines and bring one of them after the if-condition. [CODE]if(temp1->ptr==NULL) {return 0;} temp1=temp1->ptr;[/CODE] Now it's up to you to think and find what error you made and how …

Member Avatar for Ayzu
0
244
Member Avatar for jdm

[CODE]bool dayType::equalDay(const dayType& otherday) const { return (this->day == otherday.day); } [/CODE] "this" is the object with which you are calling equalDay(). You are comparing this's day and otherdays's day and returning the result.

Member Avatar for jdm
0
96
Member Avatar for rfrapp

I didn't try to understand what you are doing in your code. But, I see one mistake. Variables like digit10 which is of int type cannot hold such a big value. If int is of 4 bytes, it can go only till 2147483647 but digit10 is assigned with 68719476736.

Member Avatar for WaltP
0
289
Member Avatar for firebird102085

[QUOTE=firebird102085;1740892] Error 1 error C2106: '=' : left operand must be l-value (error on line in bold) [/QUOTE] Did you mean to put the value you get after summing [B]sum[/B] and [B]count[/B] into [B]ex[/B]. If so, you should do like this. [CODE]ex = sum + count;[/CODE] [QUOTE=firebird102085;1740892] Warning 2 warning …

Member Avatar for MandrewP
0
4K
Member Avatar for myrongainz

the reason why no body is helping is that your code is not intended at all, which makes it difficult for us to read. Please format it with proper intendation and the re-post. Also remove all the blank lines in between.

Member Avatar for zeroliken
0
200
Member Avatar for stereomatching

[QUOTE=stereomatching;1739284] I write a small program to measure the time [/QUOTE] Why don't you put the solution in a loop. Loop it some 100000... times, so that your program will give you some number. Do it separately for both solutions.

Member Avatar for mrnutty
0
118
Member Avatar for mcddewitt

I find lot of bugs in your code. 1. In the main function you are calling [B]createAndCount()[/B] without any arguments, but where as from the signature of the function, it is seen that it accepts an integer. 2. In [B]count()[/B] you are using a variable 'n' in the for loop. …

Member Avatar for subith86
0
223
Member Avatar for PrimePackster

You can simply enter your input separated by spaces. It need not be \n character always. For cin>>i>>j; you can actually enter two numbers separated by space. Or, you want a space to be inserted when you press enter, and wait for the next input?

Member Avatar for PrimePackster
0
257
Member Avatar for sync101

check this link, this should help you [url]http://linux.die.net/man/3/strtol[/url] For C++ programmers, there is another solution [url]http://www.cplusplus.com/articles/numb_to_text/[/url]

Member Avatar for WaltP
0
188
Member Avatar for freedomflyer

[QUOTE=freedomflyer;1738022] once it gets back to process_and_display_information, the data is gone.[/QUOTE] Yes, it will be gone, because the scope of [B]myStrings[/B] is only within [B]tokenize_urls[/B](). [B]myStrings[/B] is created in the stack and once the control goes out of [B]tokenize_urls[/B](), the memory will be freed. That is why you lose your …

Member Avatar for Ancient Dragon
0
182
Member Avatar for mackieben04

you are using getch(), clrscr() all of which are part of <conio.h> which you haven't included. It is also suggested not to use <conio.h> as it is not standard and not supported in many compilers. You are returning 0 in line 272, but your main function's return type is void. …

Member Avatar for mackieben04
0
219
Member Avatar for mrprassad

What do you actually intend to do? When I ran your code, for an input "abcde" I got an output "edcba". What is the problem you're finding with swap()? Just one piece of advice. Avoid writing codes like those in line 19 and 22. "++" operator may give different results …

Member Avatar for Narue
0
153
Member Avatar for srinidelite
Member Avatar for gdubz

If it's only for read only purpose, you can use your original string itself as an array of characters terminated with '\0'. [CODE] string myString = "hello world"; const char *myArray; myArray = myString.c_str(); [/CODE] Otherwise create a copy and do read/write [CODE] string myString = "hello world"; const char …

Member Avatar for subith86
0
127
Member Avatar for bluewhale628

check line 35. Syntax error. Also, I doubt int cardNumber is not initialized anywhere.

Member Avatar for Lerner
0
586
Member Avatar for guccimane

[QUOTE=guccimane;1734038]I thought everytime I allocated memory using 'new', I am suppose to free the memory using 'delete'.[/QUOTE] You are right, but you try to use the memory allocated to the linked list after deleting it. This causes the problem. So do a delete only after you are finished playing with …

Member Avatar for subith86
0
1K
Member Avatar for DarkPyros

[QUOTE=DarkPyros;1732403] the scanf at the end is to keep the program on the screen after it executes and displays the output..[/QUOTE] Use getch() function defined in conio.h thereby you can avoid using scanf() to hold the output screen. And before you proceed, you need to verify the sides belong to …

Member Avatar for WaltP
0
202
Member Avatar for srinidelite

To access element at a[5][4][9][20], use [CODE]printf("%d", *(*(*(*(a+5)+4)+9)+20));[/CODE]

Member Avatar for Moschops
0
77
Member Avatar for pororo11
Member Avatar for L7Sqr
0
5K
Member Avatar for moonw3ll

first of all if you intend to use a[] as a string, it should end with '\0' character.

Member Avatar for moonw3ll
0
235

The End.