406 Posted Topics

Member Avatar for lotrsimp12345

You haven got anything such as [icode]int random(int);[/icode]. For generation of random numbers you have got the function [B]rand[/B] which is of the format [icode]int rand(void);[/icode].Defined in cstdlib.You will get more information in this [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/rand/"]<link>[/URL].

Member Avatar for csurfer
0
97
Member Avatar for ndfi54

Apart from what Hiroshe has rightly stated,I would like to add these (after all corrections stated by Hiroshe): [B]1>[/B] [QUOTE]if (IsPrime(num)==(true))[B][COLOR="Red"];[/COLOR][/B] { printf("%d\n", num); }[/QUOTE] No semicolon at the end of if and don't do redundant work as in [B]IsPrime(num)==(true)[/B] the following is enough: [code=c] if (IsPrime(num)) //No semicolon and …

Member Avatar for ndfi54
0
246
Member Avatar for msteele

All the post above are true especially have a look at link given by [B]DaveSinkula[/B].Here I will just go with the basics to help you know the concept. [B][U]What is main actually ?[/U][/B] Main is the function which is called before all functions when we execute a C or C++ …

Member Avatar for MosaicFuneral
0
150
Member Avatar for DaveTul

[B][U]Mistake:[/U][/B] [code=c]for (i = 0; line[i] = NULL; i++);[/code] [B]1>[/B]Remove the semicolon at the end of this statement. [B]2>[/B]It should be [B]line[i]!=NULL[/B] and not [B]line[i]=NULL[/B].

Member Avatar for iamthwee
0
138
Member Avatar for pltndragon

Use code tags specific to a language it would be better. :) [B]Few mistakes present:[/B] [B]1>[/B] //Validate the input. [QUOTE]while (scores < 0) { cout << "Zero or negative numbers not accepted.\n"; cout << "Test Score #" << (count + 1) << ": "; cin >>scores[count]; }[/QUOTE] This should be: …

Member Avatar for NathanOliver
0
2K
Member Avatar for debasishbasak

Read the two dimensional array elements one by one and feed them sequentially into the single dimension array, thats it.

Member Avatar for csurfer
0
125
Member Avatar for VIkhers

[QUOTE=VIkhers;922340]dear, Mr. David... I'v tried but it's still not work. there's an error :: error C2440:'initilizing' : cannot convert from'const char *' to 'System::Byte^' I want to split the string per line sir: example: str = 111,222,333 i want it be(after I remove the delimiter ','): 111 222 333 so, …

Member Avatar for VIkhers
0
137
Member Avatar for Azurea

Few things I found out : [B]1>[/B]Your stdafx.h header is not a compulsion.The program is running even without that header and giving the desired results. [B]2>[/B]The space in the input by the user after the comma is critical.If something like [B]Montoya,Inigo[/B] would result in answer [B]nmontoya[/B] rather than [B]imontoya[/B].So add …

Member Avatar for siddhant3s
0
140
Member Avatar for MrNoob

Whats with [icode]return getchar()[/icode] ? You got several other ways to pause the output.Use one of them rather than this because even though you return some random character as the return of main and exit the OS thinks that the process didn't terminate properly because of a non zero return …

Member Avatar for MrNoob
0
149
Member Avatar for thr

Your question is cyclic : 1>A pointer to a particular class cannot be defined until the class is defined. 2>And you want to define the pointer to the class and manipulate it within the constructor of the class itself. Which is interdependent.So ask your question clearly and state your exact …

Member Avatar for thr
0
101
Member Avatar for Yaserk88

You mean to say [ICODE]Ten Point Three Eight[/ICODE] is represented as [ICODE]10,38[/ICODE] rather than [ICODE]10.38[/ICODE] ??? Well if the answer to the above question is yes then of course you cant use the float data type for your work.So define your own data type something as follows: [code=c++] class myfloat{ …

Member Avatar for Yaserk88
0
2K
Member Avatar for sdmahapatra

Why are you creating two threads for the same purpose....? [URL="http://www.daniweb.com/forums/thread204457.html"]This thread is just the same...[/URL] And with regard to your question you can create a new file say headerfile.h with .h extension and place it in your working directory.Then by usage of #include "headerfile.h" above your main() source code …

Member Avatar for sdmahapatra
0
134
Member Avatar for esesili

Remove the & pass by reference symbols from the functions [code=c]void generate_array(int& f_array[]); void print_array(int& p_array[]);[/code] Let the functions just be: [code=c] void generate_array(int f_array[]); void print_array(int p_array[]); [/code] It works fine...

Member Avatar for tux4life
0
120
Member Avatar for VernonDozier

Your question is completely dependent on the fact as to "How type safe is the language we are using?" Languages which assure complete type safety assure the release of memory at the end by the process of "[URL="http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)"]Garbage Collection[/URL]". Even though C++ is a type safe language it entertains several …

Member Avatar for wildgoose
0
188
Member Avatar for bryangarcia

[QUOTE=lighthead;919963]I think it means, read an integer as input from the user and assign it to the integer variable first_int. [code=C] int first_int; scanf("%d",&first_int); [/code] If you are still getting error, we need code and more detail to answer.[/QUOTE] You think [B]Ancient Dragon[/B] is so dumb that he couldn't give …

Member Avatar for csurfer
0
141
Member Avatar for bryangarcia

Just an added information : It is called as scope definition.It is C's way of assuring something similar and far less effective "Encapsulation" technique provided by C++. It is a way by which we set a boundary to the usage of a specific variables.It is a way in which we …

Member Avatar for csurfer
0
148
Member Avatar for naeem1973

[QUOTE=naeem1973;919489]i have a text file abc.text having 32 characters only. 2b7e151628aed2a6abf7158809cf4f3c i want to load this file in char *key[16] as below char *key[16] ={"2b", "7e", "15", "16", "28", "ae", "d2", "a6", "ab", "f7", "15", "88", "09", "cf", "4f", "3c"}; i use the following code char ch; int i=0; ifstream …

Member Avatar for kvprajapati
0
211
Member Avatar for xnoiz

Both of your thoughts are useful. 1>If you are using this data as independent units i,e when you are using the data set by set and not as a dependent quantity then you can use the single dimension arrays for your work. 2>If in case you are using the data …

Member Avatar for tux4life
0
173
Member Avatar for pltndragon

[B]Lots of things messed up:[/B] [B]1>[/B] [code=c++] if (numElements <= 0) return NULL; [/code] NULL is defined as (void*)0 and its not the right place of use.If you want to stop execution then do something meaningful as: [code=c++] if (numElements <= 0) { cout<<"Illegal value for numElements"; return 1; //Signifying …

Member Avatar for tux4life
0
2K
Member Avatar for smithss

[B]Well this is what I understand :[/B] (LHS=Left Hand Side,similarly RHS=Right Hand Side) [B]1>[/B] [code=c++]int** a = new int*[col];[/code] Here the LHS tells us that a is a 2d pointer variable i.e a pointer to a pointer type. In RHS we ask the compiler to allocate memory for "col" number …

Member Avatar for VernonDozier
1
139
Member Avatar for richm.analytica

[B][U][COLOR="Red"]We wouldn't like to collaborate with someone who is not willing to put in a bit of effort and want someone to write the code for him !!![/COLOR][/U][/B] :angry:

Member Avatar for oop'stechie
0
116
Member Avatar for Himani_29
Member Avatar for Himani_29
0
332
Member Avatar for sureronald

Well only thing I can think of is there might be some problem with your repositories.So may be you can install them again.Because some problems can arise because they are of same origin. gcc is GNU Compiler Collection which has specific packages for compilation of C++ files which we call …

Member Avatar for sureronald
0
116
Member Avatar for sdmahapatra

Well Vernon has given quite a good explanation but if you still didn't get it its ok. As the name goes "new" is to create something new and "delete" is to delete something which is already created. Here in C++ if we don't exactly know how much memory is needed …

Member Avatar for csurfer
0
229
Member Avatar for thr

[QUOTE=Grigor;915382]I'm guessing you actually have ... in your source instead of actual code. a and c are not anywhere to be found. Provide the full source code and we can help you. Also, use code tags and void main is now int main.[/QUOTE] The problem is quite clear.And there is …

Member Avatar for csurfer
0
237
Member Avatar for nanchuangyeyu

Nicely pointed by [B]Siddhant3s[/B].Whenever you pass an array to a function then its bounds should be clearly defined.The index indicating a pointer may be left as such but the array bounds should be specified as: [code=c++] float mp[][3]; [/code]

Member Avatar for Ancient Dragon
0
189
Member Avatar for Ather14

[B][U]Major mistakes[/U]:[/B] [B]1>[/B]Using conio.h its an extinct header man. [B]2>[/B]Using clrscr() its also an extinct call. [B]3>[/B]Problem here is with : [code=c++] printf("\n %d",temp); [/code] You are printing the long int temp as a signed integer so after it crosses the limit of 32767 it goes on to the negative …

Member Avatar for NathanOliver
0
181
Member Avatar for monkey_king

You can use [URL="http://www.cplusplus.com/reference/clibrary/cstring/strchr/"]strchr[/URL] function with space as the delimiter to mark the boundary of the first token and then read it accordingly.

Member Avatar for jephthah
0
3K
Member Avatar for whotookmyname

Well string class is defined so that it stops on reading a space or newline so alternatively you can do this : [code=c++] char s[20]; gets(s); cout<<"\n"<<s; [/code] This will read until it finds a \n' character and this will suffice your needs.

Member Avatar for whotookmyname
0
80
Member Avatar for anilopo

[QUOTE]tempIn.seekg (tempOut.tellp ());[/QUOTE] Problem with this line is due to seekg function. seekg and seekp calls take the position from which they need to start seeking as flags as: [ICODE]file_ptr.seekg(<offset>,flag);[/ICODE] Offset is given by tempOut.tellp() but the flag should be one among : ios::beg to start counting from beginning. ios::cur …

Member Avatar for anilopo
0
87
Member Avatar for yakovm

Its just a Compilers way of saying [B]"The main object under my concern right now is [COLOR="Red"]this[/COLOR]"[/B] ,as AncientDragon has stated its just a pointer which is maintained completely by compiler which the user cannot modify,but can make use of it foir referencing the current object.For more info try these …

Member Avatar for BestJewSinceJC
0
219
Member Avatar for Grn Xtrm

Well my first thought to this thread was [B]Reflex-i-on[/B] (reflection) and then I thought [B]Soul Rockers[/B].But ya the idea of Green extreme is good. [B]@OP[/B] : How didn't you come up with the name [B]Green Extreme[/B] your login name sounds the same right ??? [B]"Grn Xtrm"[/B]....;)

Member Avatar for Grn Xtrm
1
206
Member Avatar for GECKA

Its you who needs to decide which application you need to develop and on which platform.You have specific tools for both.So its your decision.

Member Avatar for GECKA
0
81
Member Avatar for spidyshiva

[URL="http://www.faqs.org/faqs/jpeg-faq/part1/"]Image Compression[/URL],[URL="http://www.audiodesignline.com/showArticle.jhtml?articleID=192200240"]Audio Compression[/URL] .You couldn't even find this.....?

Member Avatar for tux4life
0
96
Member Avatar for _dragonwolf_

You should have posted this under the same thread buddy.Because we need to start from the scratch in understanding if you start a new thread.Topic under same thread will let us know that its a part of it only. [B]You still have a mistake left :[/B] [QUOTE]rss.open("studentScoreData.txt",ios::in[B][COLOR="Red"],[/COLOR][/B]ios::binary);[/QUOTE] Its not "," …

Member Avatar for _dragonwolf_
0
136
Member Avatar for TheSilverFox

You are not passing any thing to the calculate function within main.So few parameters error. void Calculate( double ) Don't know what exactly you want to do with this really :?: If you want to pass any parameters then pass it else make the function as void Calculate() in both …

Member Avatar for csurfer
1
105
Member Avatar for doublebond

I don't see a hash table to read from... ;) Create a hash function according to your needs and have a look at some standard hashing functions.Once you have a hashing function pass the key parameter of the data you want to write to hashing function and get the hash …

Member Avatar for csurfer
0
1K
Member Avatar for reyaanhelp

[B]Please Note:[/B] You are using a [B]completely outdated[/B] compiler because it is letting you use [ICODE]"conio"[/ICODE] [ICODE]"clrscr"[/ICODE] and all the [ICODE]".h"[/ICODE] extensions. Get a standard compiler. You have just posted the code and the line "How to convert Structure in class" that too with a [B]spelling mistake[/B] and that [B]doesn't …

Member Avatar for csurfer
0
457
Member Avatar for zeus1216gw

[QUOTE]sorry I forgot to add the groups need to be on the same line separated [COLOR="Red"]by a blank line[/COLOR][/QUOTE] That's idiotic I think you want to say blank space. Hey you really cant expect us to give every detail.You need to work yourself.If you need the groups to be on …

Member Avatar for csurfer
0
116
Member Avatar for _dragonwolf_

float computeAverage(int scores[], int count[]) { float average = 0; int sum = 0; for(int i = 0; i < MAX_SIZE; i++) sum += scores[i]; average = sum / MAX_SIZE; return 0; } Your compute average function is still incomplete. 1st thing I don't see any usage of `count[]` that …

Member Avatar for VernonDozier
0
282
Member Avatar for cooolguy

[B]For reading: [/B][URL="http://www.cplusplus.com/reference/iostream/istream/read/"]Link[/URL] [B]For comparison: [/B][URL="http://www.cplusplus.com/reference/string/string/"]Link[/URL] And you have the information given by Ancient Dragon.Use "word" in his example as a string class object.

Member Avatar for cooolguy
0
75
Member Avatar for cplusplusfool

After [B]Ancient Dragons[/B] post the only thing I could do was to lead you to that [B]a[/B] proper source so that you can read from the standard ones rather than some link that pops up :) !!! So enjoy reading [URL="http://www.cplusplus.com/doc/tutorial/files/"][B]this[/B][/URL]. ofstream is for output particularly so just use flags …

Member Avatar for csurfer
0
148
Member Avatar for macdonpr

Ya I agree with jephtah . Start up with some easy book then when you think you know C to a certain extent you can come to K&R. Or you can even come to [B]Daniweb[/B] scan through the [B]C forum[/B]. Because here you will get more than one ways to …

Member Avatar for rampurhaat
0
184
Member Avatar for Whilliam

[QUOTE=Whilliam;908210]The node containing garbage value appears at the last..[/QUOTE] So if your concern is just the last but one node that is if you say that the node whose node->link is your junk node and you don't want to read it then you can just do this : [code=c]for(p = …

Member Avatar for rampurhaat
0
195
Member Avatar for poncho4all

[B][U]3 things before I answer your questions[/U] : 1>You are heartily welcome here until you keep showing effort. 2>Use pure English rather than message language. 3>Get yourself a decent compiler.Because Turbo C is the worst.Use Code::Blocks if you can.Or MSVisual C++ 2008.[/B] Now for your program : [B]1>[/B]Hold the DOS …

Member Avatar for poncho4all
0
109
Member Avatar for MrNoob

[B][U]@wildgoose[/U][/B] [QUOTE]You're entering pounds calling it dollars.[/QUOTE] Pound as a unit of weight not as a monetary unit. [B][U]@MrNoob[/U][/B] [B]1>[/B]toupper() is defined in [icode]<ctype.h>[/icode] and I don't see it in your headers. [B]2>[/B] Even though the problems mentioned in above posts are right most of them are problems due to …

Member Avatar for MrNoob
0
152
Member Avatar for kangarooblood

[B]Three small changes :[/B] [B]1>[/B]Use #include<string> in the beginning [B]2>[/B]Take name as [code=c++]string name;[/code]rather than char name. [B]3>[/B]Use "kevin" rather than 'kevin' in the check.

Member Avatar for Sky Diploma
0
131
Member Avatar for TrintiyNoe

Why calling the function moves.size() again and again for every loop ??? Do it once,else its just a waste of computation time. Do this : [code=c++] int max=moves.size()-1; for(i=0;i<max;++i) { if(moves[i]==moves[i+1]) k++; else cc.push_back(k); } [/code] And with respect to the segmentation fault I am not finding any problem with …

Member Avatar for Laiq Ahmed
0
121
Member Avatar for jessejamesjjr

Not only the errors mentioned in the post above it also has syntax errors and other major errors too. [B]1>[/B][code=c++]if(fp_in = NULL)[/code] you are not assigning the pointer you need to check so its[code=c++]if(fp_in == NULL)[/code] Same goes for fp_out [B]2>[/B]Why are you exactly using [icode]exit[/icode].When you are using it …

Member Avatar for wildgoose
0
175
Member Avatar for catchmrbharath

[B]1>[/B] [QUOTE]if(initial[i]=='^' ||initial[i]=='/'||initial[i]=='*'||initial[i]=='+'||initial[i]=='-') { while(!exp.empty() && [COLOR="Red"]exp.top()=='('[/COLOR]) { temp2=exp.top(); x=opgreater(temp2,initial[i]);[/QUOTE] The actual statement needed here is [icode]exp.top()!='('[/icode] [B]2>[/B]And your code is just half way across.Its just extracting the symbols used.Its not converting it from input to output. [B]3>[/B]And ya no need to declare the function opgreater because you are defining …

Member Avatar for csurfer
0
227

The End.