406 Posted Topics
Re: Well try it... Its quite simple.Your first check is good.If they are not of same length then they can't be anagrams. [B]ALGORITHM 1:[/B] Fine now if they are then just initiate two loops and match every letter of the first string with every letter of second string and when you … | |
Re: Well one of the ways for the first questions as I thought is this. 1> Take an input number n from the user. 2> "x" is an empty variable. 3> You have "y" as a number under concern. What you need to do is pick the rightmost n bits of … | |
Re: Are you asking a question or answering your own question ??? | |
Re: Well as I see it only thing I would comment on is this : [code=c++]infile.open("test.bdb", ios::in | ios::binary);[/code]is not necessary because you have declared infile as ifstream pointer. So this would be sufficient : [code=c++]infile.open("test.bdb",ios::binary);[/code] And ya apart from this I don't see any problem in the code frankly.But I … | |
Re: Thank you so much for giving us an [B][COLOR="Red"]INSANE[/COLOR][/B] assignment...but [B]We Are Not In A Mood To Do It ...!!![/B]:angry: | |
Re: Such a thing would never happen in [I]DANI[/I] because here on [I]DANIWEB[/I] [B]if there are 100s to tell you where you are right there are 1000s to tell you where you are wrong[/B]...!!! [B]Daniweb ROCKS[/B] !!! | |
Re: Well here is what you need to do : 1>Make use of an efficient hash function which will return the appropriate position of the node to be inserted in linked list.(This needs some research and work). 2>Make every key pass through the hash function and then you get the appropriate … | |
Re: [B][COLOR="Red"]Mistakes :[/COLOR][/B] [B]1>[/B] We are not here to do your work here. If you are in such a hurry to submit it on 18th go do it yourself !!! Next time you say you need it this is our reply [B]GO DO IT YOURSELF !!![/B], (Since you have put in … | |
Re: [code=c++]buffer=malloc(N);[/code] Check the malloc format.How it is to be used. [B][B]Read the community rules...Post the topic of your query,not something as help or urgent!!![/B][/B] | |
Re: [QUOTE=Zay;892623][ICODE]#include <iostream.h> main() { int n, k = 5; n = (100 % k ? k + 1 : k - 1); cout << "n = " << n << " k = " << k << endl; return 0; } [/ICODE] How the value of n become "4" ? … | |
Re: Several things are wrong with your code starting with this: [code=c] ptr = malloc(numRows*numCols); [/code] [B]Errors :[/B] What are you exactly trying to do here. This initialization is wrong not only for memory allocation of a 2dimensional array but also for 1dimensional array.What you have done is nothing but [code=c] … | |
Re: [B]Too many loop holes as I see it :[/B] [B]1>[/B]You need to work on your hash function and also your hashing concept. If you are calculating the hash value of the given word and calculating the hash value of all the words in a file and then matching it,don't you … | |
Re: The code is not only weird its senseless. Firstly two pointers buffer and i manipulating the same char array so what it writes in the array in which condition is completely unpredictable it just depends on both the inputs. And even by going by the function name [B]"squeeze2"[/B] if the … | |
Re: Well one advantage of that remote as I see is that channels wont be changed much often... Who would want to touch a slimy remote again and again...;) and ya nice list of ten things we could do without William Hemsworth. | |
Re: Well I really don't get it. [B]Here are few mistakes in your question itself :[/B] [B]1>[/B]The class definition should end with a semicolon.You haven't done it. [B]2>[/B]Where are you trying to return the array to ? I mean if you want the array within the function setName then why all … | |
Re: [B][COLOR="Red"]Guys relax.....lets help this person out .You just need to do this !!![/COLOR][/B] [URL="http://www.mathsisfun.com/fractions_addition.html"]Here is a link for third grade "Addition of Fractions" lessons.Go through this first.[/URL] [URL="http://www.research.att.com/~bs/C++.html"]And now for some C++ lessons by the designer and original implementor of C++ Bjarne Stroustrup himself.[/URL] [B]You are really lucky !!! [/B] … | |
Re: Nice post there tux4life. Just adding one more little information which is I know is very simple but just in order to complete the thread...:) Every string manipulating function like strcpy strcmp etc take in the starting address of the string as input,so here as we are using character array … | |
Re: Well you get built in options for the things you have asked both in Dev-Cpp and also Code Blocks...Try them. | |
Re: @NeoKyrgyz : Did your post add even an inch to what Salem had said ? Was that really necessary ? (Salem's post was the reason many others didn't post because it rectifies everything with respect to this thread.:) and nothing more could be added.) | |
Re: Well if you can control the output of a random function then it wont remain a [B]RANDOM[/B] function right ??? :D Well you can always do this.First assume a variable "a" which is defined as follows : [quote] 1>a=Some random number from 1 to 19 (%20) generated by some random … | |
Re: Every file ends with an [B]EOF[/B] character.Find out what the functions which [B]ArkM[/B] has stated does and use the above information and you are done. | |
| |
Re: @mrcniceguy : You are pretty old to this community 148 posts still asking for codes ??? [B][COLOR="Red"]SHOCKING !!![/COLOR][/B] | |
Re: Well fptr.open(<filename>,ios::out|ios::app) helps you to append the data to the end of the file. But I don't think you can append it from the beginning of the file because the concept of append defines itself as adding contents to the end. You can always do this : 1>Create another temporary … | |
Re: Here is an algorithm for it : [code=c++] //open a file using fstream objects say file and functions like file.open() in input mode // Create a string variable which can act as a buffer for holding the values while(getline( <file descriptor value>, <buffer object>)!=NULL) { int key; string skey,value; //extract … | |
Re: [B]Mistake 1[/B] : [B][COLOR="Red"]Put your codes inside code tags or else no one will care to look at it.[/COLOR][/B] [B]Mistake 2[/B] : exit() is a function and it is defined inside cstdlib header with respect to c++ and you haven't included it in the headers so the error not defined … | |
Re: @StuXYZ : [QUOTE=StuXYZ;887842]Several things from your question: First the string part. You have many options (a) you can indeed use insert but the method requires an iterator to define the position for insertion. (b) the easiest to use simply += e.g [code=c++] char p='x'; std::string A("test"); A+=x; // A is … | |
Re: > <conoi.h> > getch() to look at the program output Already Extinct.Try using newer standard coding styles. >Hi, >to answer this question you need to have some experience >about php... Even though relevant sounds a bit rude.It sounds like "Read my thread if you are educated enough". | |
Re: We don't really need to define [B]power[/B].And we humans fear only the things which aren't understood,so may be the undefined power defines itself in this way itself to maintain a balance in nature.We don't even need to give it a name. So if given a thought [B]"This undefined power itself … | |
Re: Errors I found : [code=c] int cla_start_count=0,i; cla_start=*cla_head; while (1) { if (cla_start_count != 0) { cla_start=*cla_head; for (i=cla_start_count;i>0;i--) { cla_start=cla_start->next; } } if (cla_start->next = NULL) // Error { break; } [/code] Error : Assignment operator instead of comparison operator.You need to use [COLOR="Green"]==[/COLOR] and you have used [COLOR="Red"]=[/COLOR]. … | |
Re: @Sky Diploma : You didn't get him I suppose... He is directly asking for the codes. He is [B]One of those highly honest [COLOR="Red"]lazy[/COLOR] code hungry fellows...[/B] ;););) Give him ten more links for great algorithms he will ask you a new one which will give him the codes directly. | |
Re: [B]"After reading all the above posts once"[/B] you will know your question itself has your answer. 1>Convert float to string. 2>Concatenate using srtcat or strncat as said by you or snprintf as said by Arkm. When you know everything did you try to [B]google[/B] out first?I think you lost your … | |
Re: Try Google Scholar and Scribd.You will get whole lots of stuff...!!! In Scribd you can even download pdf format itself... :D | |
Re: Well what are you aiming your text encryptor to work for? It just depends on the application for which you are designing it for. More over the efficiency of working of your encryptor also matters.If its fast but not a good encoder then its a waste. And what type of … | |
Re: You have a problem with the whole program or just a part of it ? Because its really hard to scan through every part... | |
Re: Spacebar is most used in my computer.Poor thing gets all my trashing (only key with two finger access).Both my thumbs just pounce on it.;) Unused key : Default windows key !!! :) | |
![]() | Re: I got how you are trying to generate the prime numbers but you have messed it up to a great extent. >Assume another variable lim which has the maximum index of prime numbers stored in array p.That is if you have got 3 prime numbers p[1],p[2],p[3] then lim is 3 … ![]() |
Re: The most [B][COLOR="Red"]Honest[/COLOR] Post[/B] I have ever seen !!! This person has directly shown us the places where we need to code for him. Wow !!! He is honestly saying [B]"Look guys i have commented in places where you need to put in your codes,and better do it fast".[/B]:D This … | |
Re: You haven't even tried to overload + and - operator. [B]First read about it,try it and come back to us with errors or bugs,then we will help you[/B]. And next time put your code inside code tags. P.S : [B][U][COLOR="Red"]We are not a bunch of jobless people[/COLOR][/U][/B]. | |
Re: Think [URL="http://en.allexperts.com/q/C-1040/RTTI.htm"]this[/URL] can help you a bit. | |
Re: @Ancient Dragon [code=c]*p2 = 0;[/code] Hey shouldn't the above code be [code=c]*p2 = '\0';[/code] more precisely to signify null character even though both lead to ascii zero itself. And you normally avoid typecasting of malloc right ? Any special purpose here ? | |
Re: I suppose you are using some compiler like TC because if you try to do something like array[-1] in gcc then it gives a segmentation fault. Actually the concept is like this.When you write a statement like [code=c]int array[10];[/code] 10 consecutive integer blocks are alloted in memory with name array … | |
Re: Try to clear the contents of the stream at strategic points. Read more on [B]"flushing the standard input stream in c"[/B]. :) You can code the getans() function in a far better way. And asking you out of curiosity "Being a newbie how did you know it was taking 10 … | |
Re: You wont get codes here,but we will help you code. Do this: 1)Take the two strings into a char array(Store those two strings). 2)Traverse through those strings and get the numeric values in that string separated by a "." character and store these values as another string. 3)Find a way … | |
Re: Take input in an char array and swap the positions.Hold two pointers say i and j i pointing to 0 and j to last input character position.Swap arr[i] and arr[j] and then i++,j--;then again swap until i=j. | |
Re: Attachment point theory is good.You can create a board in which you assign three different symbols which mean <a char is placed here>,<a char can be placed here>,<a char is not placed but you cannot place a character here.> And for the question you have asked what you can do … | |
Re: conio.h is an [B]EXTINCT[/B] header file.And we don't even want to save it. Daniweb has several discussions regarding not to use: [code=cplusplus] getch(); system("pause"); [/code] for looking at the output. But instead to use: [code=cplusplus] cin.get(); [/code] You are doing nothing but printing a string here: [code=cplusplus] for(p = listA.begin(); … | |
Re: Its better if you post the code which you have tried so that we can believe you have actually worked on it.But you have asked just for the algorithm here you have. 1)Run outer loop (say for loop) n number of times where in n=number of lines. 2)Assume a variable … | |
Re: Your code doesn't involve any c++ concepts. It is completely a c code I should say.And I think you are getting confused the order of execution is : [code=c] printf("Enter Your Age: "); // Executes 1st age = getInt(IsValidAge); // Executes 2nd printf("Enter your driving test mark: "); //Executes 3rd … | |
Re: Well you don't even need to know the number of lines in the file. Use this : [code=cplusplus] fstream f_ptr; string str; f_ptr.open(<filename>,ios::in); while(!f_ptr.eof()) getline(f_ptr,str,<delimiter>); [/code] This complies to your requirements when the fields are delimited by some value. |
The End.