75 Posted Topics
Re: 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. | |
Re: [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? | |
Re: 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] | |
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. … | |
Re: 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 … | |
Re: 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 … | |
Re: have you included iostream? | |
Re: I think a closing bracket is missing | |
Re: This should help [url]http://www.daniweb.com/software-development/c/threads/398451[/url] | |
Re: 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 … | |
Re: 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 … | |
Re: [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. | |
Re: 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. | |
Re: [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 … | |
Re: 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. | |
Re: [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. | |
Re: 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. … | |
Re: 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? | |
Re: 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] | |
Re: [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 … | |
Re: 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. … | |
Re: 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 … | |
Re: [CODE]b2 = &b1[0]; (b2+i)->iPageNo[/CODE] And no need of typedef | |
Re: 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 … | |
Re: check line 35. Syntax error. Also, I doubt int cardNumber is not initialized anywhere. | |
Re: [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 … | |
Re: [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 … | |
Re: To access element at a[5][4][9][20], use [CODE]printf("%d", *(*(*(*(a+5)+4)+9)+20));[/CODE] | |
Re: pls try this. [url]http://www.cprogramming.com/fod/putenv.html[/url] | |
Re: first of all if you intend to use a[] as a string, it should end with '\0' character. |
The End.