1,171 Posted Topics

Member Avatar for ermithun

[QUOTE=ermithun;904798]Hello All Can anyone provide me a sample code, executing which generates a segmentation falut. need to understand how it works. Thanks.[/QUOTE] If you really want it: [CODE=cplusplus] for(int *p ;;) *p = 5; [/CODE] Good luck with it :P Edit:: But I really don't see how you'd understand it …

Member Avatar for tux4life
0
188
Member Avatar for XTRobot

[QUOTE=XTRobot;901886]on,i have heard of API and GUI what is the diference ? [/QUOTE] Most of the time, the functions to create a GUI are part of an API, but the difference lies in the fact that an API doesn't necessarily have to feature a GUI, we could for example talk …

Member Avatar for XTRobot
0
282
Member Avatar for lotrsimp12345

Should the program prevent input like: [ICODE]A3--5,9-01[/ICODE] ?? Is it allowed that the problemset's name contains more than 1 character ? What to do with things like: [ICODE]A35,9-01,A-Z-9[/ICODE] ??[B] >And then convert it back to char with itoa()[/B] itoa() is non-standard.

Member Avatar for jackcppi2
0
292
Member Avatar for kostasxx

First create an integer type (of the GNU MP library), and then have a look at this: [URL="http://web.mit.edu/gnu/doc/html/gmp_4.html#SEC11"]http://web.mit.edu/gnu/doc/html/gmp_4.html#SEC11[/URL]

Member Avatar for tux4life
0
320
Member Avatar for zeus1216gw

[QUOTE=nirav99;903612]if you have to make a fact. of x for(i=x;i>=1;i--) { fact=fact*i; // fact = 1 } cout<<fact; put this logic in your program.. it should be work..[/QUOTE] Check your profile, how many times do you want to hear saying us: "Use code tags!!" ?? Information about code-tags is spread …

Member Avatar for tux4life
0
174
Member Avatar for lotrsimp12345

[QUOTE=lotrsimp12345;904291]i have created a C string of my variables and guessing i need some king of loop to check each character after it gets it?[/QUOTE] Could you please post the code you have?

Member Avatar for tux4life
0
136
Member Avatar for Raza Najam
Member Avatar for Hiroshe
0
96
Member Avatar for gretty

[U][B]Struct(ure):[/B][/U] In C++ you could say that a [B]struct[/B] is also a sort of class, but when someone uses the struct keyword, he's often just referring to a structure as ([B]POD[/B] = Plain Old Datatype), POD means that it's used as they did before in C: a structure is used …

Member Avatar for Nick Evan
0
266
Member Avatar for crash1989

Could you please post using code tags? Information about code-tags is posted all over the website : 1) in the Rules you were asked to read when you registered 2) in the text at the top of this forum 3) in the announcement at the top of this forum titled …

Member Avatar for crash1989
0
642
Member Avatar for Pramoda.M.A

That's because for each integer printed, all operations will be executed. For example, with me this would give the following output: [ICODE]4 5 4 5 4 5[/ICODE] The first integer printed, is the result of all the following operations, executed directly after each other: [B]i,i--,--i,i++,--i,i++[/B] Let's step through this: At …

Member Avatar for csurfer
0
149
Member Avatar for timos

[B]>"->" is used to access data members on the heap[/B] The arrow operator [B]->[/B] is used to access data members (of a class) via a pointer, these data members do not necessarily have to be on the heap, consider the following example: [CODE=cplusplus] // declaration of the 'counter' structure: struct …

Member Avatar for athlon32
0
126
Member Avatar for Stormy_Weather

[B]>Is there any way to build the program, so that it is an .exe file that can be used independently?[/B] Yes, sure there is! I assume you can run the program from within Visual Studio? In that case you just browse to the folder where your project is saved in, …

Member Avatar for tux4life
0
235
Member Avatar for paroshm

[B]>Do you think this would cause memory problem?[/B] Well, that actually depends on how much RAM there's inside your computer, whether you're planning to create arrays of structures, etc. ... You can quickly check how much bytes a structure occupies in your computer's memory by using the [B]sizeof[/B] operator. You …

Member Avatar for tux4life
0
131
Member Avatar for colmcy1

[B]>First make sure in your code every time you open a file you close it.[/B] Any [B]fstream[/B] (and thus also [B]ifstream[/B] / [B]ofstream[/B]) object has what's called a [B]destructor[/B], this destructor will close the file automatically when the file-object goes out-of-scope. So actually there's no need to explicitly close a …

Member Avatar for u8sand
0
91
Member Avatar for tomtetlaw

And a little addition to niek_e 's post: To get the amount of bytes a[B] float[/B] and a [B]double[/B] occupy in memory (on your implementation), you can use the [B]sizeof[/B] operator: [CODE=cplusplus] cout << "Float: " << sizeof(float) << endl; cout << "Double: " << sizeof(double) << endl; [/CODE]

Member Avatar for siddhant3s
0
133
Member Avatar for arun_354

[URL="http://siddhant3s.googlepages.com/how_to_tell_rusted_cpp.html#SECTION00044000000000000000"]http://siddhant3s.googlepages.com/how_to_tell_rusted_cpp.html#SECTION00044000000000000000[/URL]

Member Avatar for u8sand
0
575
Member Avatar for xyzt

[QUOTE=Tom Gunn;897794] [code=c] struct test { int first; int second; int third; }; struct test a = {0, 0, 1}; /* Old way */ struct test b = {.first=0, .second=0, .third=1}; /* New way */ [/code] [/QUOTE] Seems like the new way is always longer if you want to initialize …

Member Avatar for tux4life
0
131
Member Avatar for arun_354

Could you please [URL="http://http://www.daniweb.com/forums/misc-explaincode.html"]post using code tags[/URL]? It looks better to me if you'd migrate your code to be more standard, [URL="http://siddhant3s.googlepages.com/how_to_tell_rusted_cpp.html"]this guide[/URL] will help you to accomplish the task :) And also: what problem are you having with this code? (you only posted your code, but you didn't ask …

Member Avatar for tux4life
0
131
Member Avatar for Sushma21

Could you post down your code (please use code tags) and the contents of the file as well?

Member Avatar for Sushma21
0
122
Member Avatar for SP IT

Hey, why not telling him to post using code tags? [U]To the OP:[/U] Information about code tags is spread over whole Daniweb: 1) in the Rules you were asked to read when you registered 2) in the text at the top of this forum 3) in the announcement at the …

Member Avatar for csurfer
0
120
Member Avatar for SP IT
Member Avatar for SP IT

Have you already tried to solve it? Edit:: Where are you having problems with?

Member Avatar for SP IT
0
205
Member Avatar for kris4th

[QUOTE=kris4th;902160]I need to create a program that adds two sets, hint: the set is composed of distinct (integer) How to do this using this Function: void add(int result[],int item,int *count); add result the value of the item. Please i really need ur immediate help...pls600x[/QUOTE] Well, here's my immediate help: Can …

Member Avatar for csurfer
0
129
Member Avatar for ludasha

Quote: [QUOTE=Salem;902176]What is your C++ question?[/QUOTE] And let it say me again: What is actually [B]your C++ question[/B]? It's pretty much difficult to solve a C++ problem, if we even don't know the problem :P

Member Avatar for tux4life
0
82
Member Avatar for art-1001

>Need an idea Well, you've got pretty much everything you need to start writing code. Could you first write some code and post it down? Also tell use where you've problems with to implement. Problems in writing code? Try to break the problem down into separate small problems (this process …

Member Avatar for tux4life
0
93
Member Avatar for valinux

[B]>Well, now you know how it feels to get negative rep[/B] Are you implying that you gave him bad rep only for giving someone bad rep? BTW, Do you really think he's crying for getting 1 point bad rep? He only doesn't find it nice if you give him bad …

Member Avatar for tux4life
0
169
Member Avatar for ramthegreatcv

[QUOTE=csurfer;901678][B]Answers:[/B] [B]1>[/B]Assume that there is a class as: [code=c++] class check{ int a; public: check() { cout<<"Constructor"; } check(int i) { //copy constructor code } . . [/code] [/QUOTE] Look at this: [CODE=cplusplus] check(int i) { //copy constructor code } [/CODE] Why would this be a copy constructor? It's just …

Member Avatar for tux4life
0
193
Member Avatar for bahr_alhalak

Don't use [B]conio[/B] ([ICODE]#include<conio.h>[/ICODE]), it's unportable! To the OP: Are you encountering any problems with your current code? (as you only posted your new code)

Member Avatar for bahr_alhalak
0
225
Member Avatar for u8sand

[B]>I made a game, and my friend told me: It doesn't work on linux.[/B] Because it's a Windows API function. That's why :) [URL="http://www.wxwidgets.org/"]wxWidgets[/URL] probably features a comparable function.

Member Avatar for tux4life
0
161
Member Avatar for the_nice_guy

You haven't defined the bodies for the constructors: [B]manager();[/B] etc... Edit:: [QUOTE=the_nice_guy;901645] [CODE] [COLOR="Green"][B]/*** Fixes to make it compile are made in Green ***/[/B][/COLOR] #include<iostream> #include<string> using namespace std; class base_employ { protected: string First_Name; string Last_Name; double Salery; public: base_employ() [COLOR="Green"][B]{}[/B][/COLOR] base_employ( string &FN, string &LN, double S) { …

Member Avatar for the_nice_guy
2
78
Member Avatar for SP IT

[QUOTE=SP IT;901517]I really need you all's help.[/QUOTE] Great! Start a thread in the appropriate forum (about the topic where you require help for) and we'll be glad to help you out. Remember to not forget to read the forum rules + the member rules before starting any thread :)

Member Avatar for tux4life
0
26
Member Avatar for wasif005

Could you please post using code tags? Information about code-tags is available all over Daniweb : 1) in the Rules you were asked to read when you registered 2) in the text at the top of this forum 3) in the announcement at the top of this forum titled Please …

Member Avatar for wasif005
0
120
Member Avatar for VBNick

[B]Edit:: Direct after replying I noticed the date of the last post. Edit:: However, this might still be a useful advice for anyone who reads the thread.[/B] [B][U]Bad coding practices![/U][/B] [LIST=1] [*][ICODE]!fin.eof()[/ICODE] Check out [URL="http://www.gidnetwork.com/b-58.html"]this[/URL]. [*][ICODE]system("pause");[/ICODE] Check out [URL="http://www.gidnetwork.com/b-61.html"]this[/URL]. You could use [ICODE]cin.get()[/ICODE] as a replacement. [*][ICODE]return 1;[/ICODE] Why would …

Member Avatar for tux4life
0
158
Member Avatar for yun

>it simply skip it when i put values for Course Name and press enter it go to the next line which is code.. can any one tell me any solution.. Yes, [URL="http://www.daniweb.com/forums/thread90228.html"][B]this[/B][/URL] will help you out :)

Member Avatar for pspwxp fan
0
231
Member Avatar for tag5

And here the complaining starts all over: Don't use [B]void main()[/B], it's evil!! [URL="http://siddhant3s.googlepages.com/how_to_tell_rusted_cpp.html"]Migrate to standard C++[/URL] [B]>but i was unable to display numbers like 365 in words[/B] Well, where do you think the "hundred" will be inserted ? Why using [B]goto[/B] if you can easily use a [B][URL="http://www.cplusplus.com/doc/tutorial/control/"]while[/URL][/B] loop …

Member Avatar for u8sand
0
313
Member Avatar for ganesh_bala

The [URL="http://gmplib.org/"]GNU MP Bignum[/URL] library is a very good one :)

Member Avatar for Hiroshe
0
142
Member Avatar for athlon32

[QUOTE=athlon32;899919]Just few quick question: How often are pointers to functions used? Should i implement them in my programs?[/QUOTE] To be honest I have never had to use them up until now. You should only implement something in your program if there's need to, it's not because you've the possibility to …

Member Avatar for athlon32
0
122
Member Avatar for whitel

And if you only want the file names then use: [CODE=DOS] dir /b > files.txt [/CODE] :) Edit:: You can also combine this one, with sknake's one: [CODE=DOS] dir /b /s > files.txt [/CODE]

Member Avatar for tux4life
0
61
Member Avatar for mirfan00

This program is real rubbish, old style headers, conio, half of the code is commented out, system("pause") (don't use it), etc... My recommendation is: [URL="http://siddhant3s.googlepages.com/how_to_tell_rusted_cpp.html"]migrate to standard C++[/URL] first, they really should make it a forum rule... BTW, Does it really hurt you to use code tags: 1) in the …

Member Avatar for tux4life
-1
256
Member Avatar for Zay

[B]>i mean give letter B value smaller than the value of the letter A , is it possible ?[/B] Yes. [B]>and what is the real benifet of the enumeartion in general ?[/B] Consider this: [CODE=CPLUSPLUS] enum animal {CAT, DOG, FISH, COW}; animal a = FISH; if( a == FISH ) …

Member Avatar for Zay
0
125
Member Avatar for veronica_0501

[B]>is there anyone who could help. thankss very much. this is due on 7th July . [/B] Seems like someone is thinking that we will do it for him. Could you maybe first post what you have so far? Edit:: If you had searched the forums before posting your homework …

Member Avatar for tux4life
0
250
Member Avatar for ravikiran032

28 Posts, and no code tags?? [QUOTE] Information about code-tag is posted all over the website : 1) in the Rules you were asked to read when you registered 2) in the text at the top of this forum 3) in the announcement at the top of this forum titled …

Member Avatar for MosaicFuneral
-1
102
Member Avatar for RoninMastaFX

[QUOTE=William Hemsworth;899040] I'm not even going to bother trying to understand that code, but it's full of small bugs such as this:[code]if(number[i] [B][COLOR="Red"]=[/COLOR][/B] pi || number[i] == PI || number[i] == Pi || number[i] == pI)[/code]Not to mention the entire line is pointless anyway. My advice for you is to …

Member Avatar for jephthah
0
135
Member Avatar for Hiroshe

[U][B]A quick guide on passing variables by reference, using pointers[/B][/U] Consider this function: [CODE=C] void padd(int *p, int b) // create a pointer to an integer variable (parameter) { *p += b; // add the value in 'b' to the number } [/CODE] You'll have to use the function like …

Member Avatar for tux4life
0
154
Member Avatar for kangarooblood

You could easily use a loop for things like this: [CODE] cin >> Number[0]; cin >> Number[1]; cin >> Number[3]; cin >> Number[4]; cin >> Number[5]; cin >> Number[6]; cin >> Number[7]; cin >> Number[8]; cin >> Number[9]; cin >> Number[10]; cin >> Number[11]; cin >> Number[13]; cin >> Number[13]; …

Member Avatar for wildgoose
0
2K
Member Avatar for krishnampkkm

[B]>Memory is deleting here???...what is happening....?[/B] Well, my eyesight is not good enough to see your code from here :P Could you post it please?

Member Avatar for Salem
0
250
Member Avatar for johnray31

[QUOTE=adatapost;897549]Use typeid keyword. [CODE=C++] cout << typeid(p).name(); [/CODE][/QUOTE] And include the [B]typeinfo[/B] header: [ICODE]#include <typeinfo>[/ICODE] :)

Member Avatar for tux4life
0
125
Member Avatar for linsz

Smart trick, using two different accounts to post the same question across multiple forums on Daniweb: [URL="http://www.daniweb.com/forums/thread199505.html"]http://www.daniweb.com/forums/thread199505.html[/URL] [URL="http://www.daniweb.com/forums/thread199506.html"]http://www.daniweb.com/forums/thread199506.html[/URL] Congratulations! You've just decreased you own chances of being helped by the people here :)

Member Avatar for tux4life
0
270
Member Avatar for tux4life

[B][COLOR="Red"]First:[/COLOR][/B] I'm not asking how to do this, just carry on... Hey, I found a nice link on how to read C/C++ declarations: [B][URL="http://unixwiz.net/techtips/reading-cdecl.html"]http://unixwiz.net/techtips/reading-cdecl.html[/URL][/B] I'm leaving it here for anyone... I hope it will be useful to you!

Member Avatar for xyzt
0
98
Member Avatar for Cheesey

Normally code is wrapped between code tags, [URL="http://www.daniweb.com/forums/misc-explaincode.html"]learn how to use them[/URL] and increase your chances of being helped by the forum members :)

Member Avatar for Cheesey
0
294

The End.