406 Posted Topics

Member Avatar for slychronic

You might appreciate a full answer but we don't appreciate the idea of giving code here in this forum. So write your own program to implement the [URL="http://en.wikipedia.org/wiki/Steinhaus%E2%80%93Johnson%E2%80%93Trotter_algorithm"]Jhonson Trotter[/URL] algorithm or Heap permute algorithm using binary heaps given in A. Levitin, Introduction to The Design & Analysis of Algorithms, Addison …

Member Avatar for csurfer
0
133
Member Avatar for GHETTO COWBOY

Solution is quite simple.Don't insert it from the end insert it from the beginning. Assume the below given is your list : N1->N2->N3->N4->N5->NULL Say you have a pointer called head which does nothing but points to the starting node of the list then your list looks like : head->N1->N2->N3->N4->N5->NULL The …

Member Avatar for csurfer
0
133
Member Avatar for Photomotoz

Check out the implementations of [URL="http://www.cplusplus.com/reference/stl/map/"]map[/URL] and [URL="http://www.cplusplus.com/reference/stl/multimap/"]multimap[/URL] if you want to know about the implementation of hash tables. But in my view instead of creating a separate hash table why not use the functionality of priority_queue itself which has the largest element always at top? Try to collect the …

Member Avatar for csurfer
0
145
Member Avatar for sahil1991

@alwaysLearning0 : What you said is almost right but there is nothing called static memory in the context we are talking. every process is arranged into following segments : Text Segment : Which holds the code. Data Segment : Which holds the static and global variables. The remaining memory allocated …

Member Avatar for mike_2000_17
0
155
Member Avatar for DarkSatan

[URL="http://www.daniweb.com/forums/thread319487.html"]***Your previous thread for the same question****[/URL] Why did you create a new thread for the rectification in the question you posted...? You could have did the correction in the previous thread itself. Moreover it has been answered already in the previous thread.Now its your work to put in a …

Member Avatar for DarkSatan
0
128
Member Avatar for DarkSatan

This is definitely not an exam question its a question picked up from some coding competition or as the "Note:" section says that its an assignment as it speaks of the submission and the criteria to be met before the submission. Anyways these type of question normally follow a format …

Member Avatar for csurfer
0
322
Member Avatar for nickx522

@Unimportant : hours(minutes/60) would act like a ground function and give 4 hours for 241 minutes and not five.(you need to increase minutes by 60 or add 1 to the hours value in order to make it act like a ceiling function i,e (241+60)/60 = 5 and (241/60)+1 = 5). …

Member Avatar for nickx522
0
164
Member Avatar for DonutsnCode

cout always looks out for a type which it can output or another object of its own data type that is "ostream&" but you are passing a void type to it by using the myObject.displayObject() in line with cout.Rectify it and you are done.

Member Avatar for DonutsnCode
0
139
Member Avatar for manalibhadula
Member Avatar for stevanity

Its quite straight forward right ? Assuming int n = strlen( <Message> ); Then the order of the matrix say ord should be the smallest integer i which satisfies the equation i*i*2 >= n ( where i is the smallest integer which satisfies this equation ) Now for any square …

Member Avatar for stevanity
0
400
Member Avatar for mannuel1021

The algorithm just says : [code] //Input Array[0..n-1] unsorted //Output Array[0..n-1] sorted for i ranging from 0 to n-2 min = i; for j ranging from i+1 to n-1 if Arr[j] < Arr[min] min = j; Swap( Arr[i] , Arr[min] ) [/code] You can implement the above algorithm of selection …

Member Avatar for csurfer
0
195
Member Avatar for keskor

@andy124 : So this turns out to be a good opportunity for you to learn C++. Try to implement thats the only way you will learn.

Member Avatar for csurfer
0
812
Member Avatar for poojabi

*+abc should be treated as (a+b)*c so in a prefix expression traverse the expression until you find two operands after an operator and use that operator on that operand then go on doing the same thing for the rest of expression. If you know queue then you can obviously play …

Member Avatar for Schol-R-LEA
0
1K
Member Avatar for Urv73

If you have inp_Sec as your input of seconds then you can use it as : [code=c++] //Here you are trying to acquire all those seconds which cannot be converted to minutes ie anything short of sixty seconds out_Sec = inp_Sec % 60; //Here you convert it into proper minutes …

Member Avatar for csurfer
0
128
Member Avatar for Rahul.menon

@AncientDragon and Rahul.menon What Ancient Dragon has suggested and what you are trying to do is both right but I have a suggestion here which may sound a bit off the line. Why not read the floating value as a string(char array) instead of a float ? Because as we …

Member Avatar for Ancient Dragon
0
150
Member Avatar for DGeneral

Instead of reading the entire line at a stretch and then trying to cut it convert it etc try reading column by column with space as the delimiter as [code=c++] //istream& getline ( istream& is, string& str, char delim ); getline(fPtr,str,' '); [/code] If you know exactly how the file …

Member Avatar for Fbody
0
9K
Member Avatar for afizaex

Few things you can try out : 1)Read the blurred out print of the image you so nicely posted(If you can read). 2)Understand the problem and try to solve it.(If you have time) 3)Refer to some good links on the net to get more knowledge(On C++)rather than chickening out. After …

Member Avatar for afizaex
0
134
Member Avatar for myk45

@myk45: Just explaining what gerard4143 said in simple words. First usage is allowed as what ever usage of pointer you make its still remains a pointer and takes up a standard amount of memory which is normally equal to the size of your integer variable.So it can be defined without …

Member Avatar for myk45
0
94
Member Avatar for pandaEater

You are in the right track.But try to see the code in this way for ease of visualization... [CODE=c++] for(int i = 0; i < n-1; i++) { x=(int)pow(2,i); for(int j = 1; j <= x; j++) cout << j << endl; } [/CODE] You can see that here too …

Member Avatar for gashtio
0
381
Member Avatar for rinkuburagohain
Member Avatar for rinkuburagohain
0
130
Member Avatar for mrnutty

[B]Problem 1:[/B] [I]Legend : [/I] Summation where z ranges from low to high( ) :: S-z-[low]-[high]( ) Above stated problem is as follows... S-i-[0]-[n-1]( S-j-[0]-[i-1]( S-k-[0]-[j-1]( 1 ) ) ) S-i-[0]-[n-1]( S-j-[0]-[i-1]( j ) ) S-i-[0]-[n-1]( (i-1)*i/2 ) S-i-[0]-[n-1]( (i^2-i)/2 ) 1/2 * { S-i-[0]-[n-1]( i^2 ) - S-i-[0]-[n-1]( i …

Member Avatar for csurfer
0
125
Member Avatar for 4824hbk

All that I can see is that in an odd numbered line its adding 1 and in even numbered line the multiples of that even number are printed... Any more inputs ...???

Member Avatar for csurfer
0
89
Member Avatar for cpt clueless
Member Avatar for kirvie

[URL="http://www.cplusplus.com/reference/string/getline/"]getline[/URL] marches forward in the file once it has read the line,and you have made no effort in "case 1" to read the file from starting again. There lies your problem. In order to check , first try to find account number 1 then 2 then 3 it does give …

Member Avatar for csurfer
0
160
Member Avatar for ZeRo 00

Well your requisites aren't clear so mention them in detail. Apart from it you can initiate a char array and then get the input through simple scanf() function. Then use strtok() with array address and space as delimiter to get the first token and then loop over and get the …

Member Avatar for ALi Nuces
0
96
Member Avatar for alvalany

[QUOTE=Tom Gunn;1015603]Why not?[/QUOTE] For several obvious reasons Tom Gunn : 1)Because it is sub standard. 2)Uses all the extinct headers and commands. 3)It is not according to the c99 standards. 4)void main is valid in it. 5)The blue screen irritates a lot... ;) And loads other stuff.........

Member Avatar for Ancient Dragon
0
971
Member Avatar for ultrAslan

Explain your needs properly and paste in the code which you have[B] tried[/B].

Member Avatar for mrnutty
0
95
Member Avatar for micjan

[B]@micjan : [/B][COLOR="Red"]Congrats you got the code !!! I certainly wish the two smart people above get you everything you want in your life ... because with this attitude you are not gonna learn or earn anything...!!![/COLOR]

Member Avatar for WaltP
-3
123
Member Avatar for csurfer

Hello Everyone, I am developing a kernel module which acts as a sniffer and also a module which edits the TCP packet window size as per requirement of the admin. And in the process I developed this kernel module which is tainting my kernel (Opensuse11.2).The sniffing module developed by me …

Member Avatar for nezachem
0
299
Member Avatar for orwell84

C runs on some rules,you need to learn them before trying out something,and ya you cannot just translate a code to C and expect it to work. [code=c] int maxprimes; int count = 1; int value = 1; int primes[maxprimes]; int composite; int i = 1; int j; printf ("How …

Member Avatar for orwell84
0
113
Member Avatar for taggz19

[B]You can do these :[/B] [B]1>[/B]Well if its just a matter of printing then [icode]"%.nf"[/icode] where n is the number of digits after the [icode]"."[/icode] you want to print in a floating point number. [B]2>[/B]If its really about conversion then you can know the IEEE floating point format for your …

Member Avatar for peter_budo
0
402
Member Avatar for Shillz

May be a printf within a printf would do the trick.Because the inner printf doesn't require the semicolon.

Member Avatar for Shillz
0
152
Member Avatar for cartman714

[B]I just hope I could key in the same number of characters from keyword in 30 sec[/B].At least that would help me to code in hell lot of code in minutes ;)

Member Avatar for GrimJack
0
300
Member Avatar for kavitha1591

Woooosh......!!! Don't worry Sid you'll get the stuff you need...the OP will pay you with these for writing out her program ;) if she could get away from all our flaming !!! :)

Member Avatar for rimmmeee
0
192
Member Avatar for somaja

[B][U]@somaja :[/U][/B] Ya ya you have caught our attention , now can you please stop using the [COLOR="Red"][b]BOLD RED COLOURED[/b][/COLOR] text...??? And ya use [URL="http://www.daniweb.com/forums/misc-explaincode.html"]code tags[/URL] when posting your code. [B][U]@somaja & squ :[/U][/B] Post in your progress in solving the program till now you will definitely get help from …

Member Avatar for squ
0
409
Member Avatar for green_leav

This OP deserves an applaud, he is so honest that he is directly giving us his assignment copy and asking us directly to code for him. :D Really sorry,here your honesty doesn't pay you the code you need.You need to work.Work hard and code yourself.

Member Avatar for Sky Diploma
-1
154
Member Avatar for hiprakhar

[QUOTE=hiprakhar;1019344]Hi this is the code for life, universe and everything problem, where the program stops only when the user inputs the number "42" I tried to understand the problem, but could not make it that how the program stops at exactly 42. Any help would be extremely appreciated. [CODE]#include <iostream> …

Member Avatar for hiprakhar
0
131
Member Avatar for cjjack88

[B]Before worrying about big things please pay some attention towards small things[/B]... There is a lot of difference between [B]1 and '1'[/B] . The input you are taking is a character so the cases of switch should be as case '1' : case '2' : and all , else make …

Member Avatar for cjjack88
0
165
Member Avatar for klackey19

There are several problems and it starts from main() only. 1)[code=c++] char *c; *c = line [0]; [/code] Assigning a character value to an address which doesn't point to any memory. According to your code this line has to be: [code=c++] char *c; c = &line [0]; //or char *c …

Member Avatar for klackey19
0
116
Member Avatar for cfuilip

Idea for the topic Yes...Code a simple software for a shop or something.It involves file handling as you need to use them for information write and fetch operations. And a complete no for the example... Because we want you to code.

Member Avatar for Shillz
0
81
Member Avatar for uttara

[COLOR="Red"]No you will not have the program code[/COLOR]. Such programs are called [B][U]QUINES[/U][/B] if you want the program,read about them and then write. [B]We are not a bunch of jobless people waiting to code for free.[/B]

Member Avatar for csurfer
0
73
Member Avatar for tux4life

Your code snippet can be shortened tux...here it goes: [code=c++] void reverse(char p[]) { int len=strlen(p); for(int i=len-1, j=0;j<i; i--, j++) { // exchange elements p[i]^=p[j]^=p[i]^=p[j]; } } [/code] Try it and do tell me what do you think...???

Member Avatar for Nick Evan
0
1K
Member Avatar for jamdownian

You need to pay more attention in your classes.Very silly mistakes. [B]1)[/B] [code=c++] vowels::vowels () { int a=0; int e=0; int i=0; int o=0; int u=0; int y=0;input=""; } [/code] Class functions are used to manipulate the variables declared within the class.Here by declaring the variables again you are just …

Member Avatar for jamdownian
0
137
Member Avatar for dangutdavid

[B]@dangutdavid and Phil++[/B] : [COLOR="Red"]Both of you need to understand your basics well because without it you cant code anything.[/COLOR] Error 1 : Line 7 : Initializing A even before declaring it. Error 2 : Line 38 : getch() ??? And please tell me that this program has no logic,the …

Member Avatar for csurfer
-2
92
Member Avatar for fza.h
Member Avatar for klackey19

Lots of problems only in pointers. [B]1)[/B] Yes you guessed it right the declarations should be of form [iCODE]<function>(char *)[/ICODE] format. [B]2)[/B] Consider the following example: [code=c++] void function(char *a) { // Function Definition } // Somewhere in main char arr[20],a; char *p; p=&a; // Call can be either like …

Member Avatar for klackey19
0
890
Member Avatar for Phil++

Your customers function is a total mess. Apart from the errors mentioned by Ancient Dragon and jonsca above I felt these were wrong. 1) The criteria should be matched with a previously available list of customers but here you are creating a new customer list which totally makes no sense. …

Member Avatar for VernonDozier
0
108
Member Avatar for mayanktalwar

Here is your faulty code : [code=c++] for(;k%5==0;) y++; k++; [/code] Your [icode]k%5[/icode] checks if its value is 0 until its not zero k++ executes very well.Once k becomes a multiple of 5 then the for loop [code=c++] for(;k%5==0;) y++; [/code] Will never quit because you will increase y , …

Member Avatar for mayanktalwar
0
112
Member Avatar for CDWITH

These are the steps: 1)First write a program to dynamically allocate memory for a matrix,input values to it and print them. 2)Now take a pen and paper and find the inverse of that matrix step by step. 3)Analyze the steps and code for it finally. 4)Correct the mistakes which you …

Member Avatar for merse
-1
44
Member Avatar for brown_iris
Member Avatar for csurfer
0
86

The End.