193 Posted Topics

Member Avatar for En-Motion

You should remove your scanf statements from the if {} and move them to under the while loop Something like this will keep looping until you have the correct number. Or you could restrict the user to a maximum number of guesses. [icode] while (loop==0){ printf("Guess> "); scanf("%d", &guess); if …

Member Avatar for En-Motion
0
104
Member Avatar for hapiscrap

You need to explain what problem you have with this code. Also it should be [code=cplusplus]

Member Avatar for Sky Diploma
0
217
Member Avatar for siddhant3s

Well you can go into your Windows Explorer, Folder Options, File Types set the default program to your program name for the types you want opened with your program. If you can open the file by using "Open With", this should work for you.

Member Avatar for siddhant3s
0
115
Member Avatar for mikeregas

A recursive palindrome is pretty simple, here is my attempt at the pseudo-code for it. [icode] function isPalindrome(char* str, int len): if len <= 1: return true; // we have a palindrome if len > 1; if str[0] == str[len] isPalindrome (str + 1, len - 1); else return false; …

Member Avatar for stilllearning
0
74
Member Avatar for justinlake888

A global variable is a variable that you can access from every scope. That is, you would normally define it outside any function, and all of your functions would have access to it Local variables are defined it inside your function, and are passed as an argument to any other …

Member Avatar for stilllearning
0
114
Member Avatar for launic

You have to store the file name with location of the file. Otherwise there will be no way to access it later. So I'd suggest creating a string which has the location and the file name ie "C:\MyDir\MyFile". Also what you do mean by "it doesn't recognize it as a …

Member Avatar for stilllearning
0
98
Member Avatar for cperepelitsa

Well most of these are linker errors, "undefined reference to function foo()" ... you need to locate where these functions are in the code and make sure that those files are being compiled and linked correctly. For example its missing the function _S_empty_rep_storage

Member Avatar for ArkM
0
153
Member Avatar for DevC++4.9.9.2

Why on earth are you deleting ptr in List::insert() [icode]delete ptr;[/icode] Once you delete it your ListPtr points to garbage, and essentially at the end of the insert you will have no valid elements in the list. You need to delete your list in the destructor.

Member Avatar for DevC++4.9.9.2
0
157
Member Avatar for core2d

You could try using 2 pointers, where you increment the first pointer by 1 and the second pointer by 2. That way when the second pointer reaches the end of the list, the first one is at the middle. You can figure out whether its odd or even by making …

Member Avatar for Sky Diploma
0
132
Member Avatar for ae012

cin attempts to read an integer from standard input. It waits until the user presses <Enter> and then attempts to convert the values entered and stores them into your variables. You can read multiple values at a time, by storing them in different variables. ie cin >> accountno >> amount …

Member Avatar for ae012
0
93
Member Avatar for unk45

There is another problem with your code [icode] if(people[i].lastname == lastname) [/icode] You cannot compare two char arrays with the == operator. You either need to define them as "string" or you need to use strcmp() to compare them.

Member Avatar for stilllearning
0
232
Member Avatar for Geard2

In order to delete an element from a singly linked list, you need to save the previous pointer, and set a current pointer. You may do something like : [icode] if (current->data== max){ tmp = current; // is current the head, if so move the head. prev->next = current->next; current …

Member Avatar for stilllearning
0
114
Member Avatar for rob_xx17

You probably want to put a break after each case statement in your switch ? otherwise it will just go onto the next one [icode] switch (number){ case 1: break; case 2: break; ...... } [/icode]

Member Avatar for rob_xx17
0
108
Member Avatar for san_sarangkar

lol .. I am always amazed by such questions .. there is complex stuff and then there are just idiotic unreasonable expectations and this falls in the latter category. how on earth do you expect to generate n numbers without using a loop ? Now you could write n assignment …

Member Avatar for Aia
0
151
Member Avatar for patricksquare

First add code tags, and explain what your problem is. Also this looks like a C program, so you probably want to post it in the C forum.

Member Avatar for bhoot_jb
0
188
Member Avatar for DanDaMan

As far as I know, the compiler should just ignore the comments while parsing your code. So it should not have any effect on executable size or speed.

Member Avatar for Denniz
0
366
Member Avatar for DogfoodEnforcer

unsigned int value would be your decimal value. The [icode] static const char *binary[/icode] is a list of binary values that are being converted to their decimal equivalent. In your case you are getting this input from the user, so you don't need it. Also since a user could enter …

Member Avatar for Freaky_Chris
0
180
Member Avatar for patricksquare

Again, add your code tags, explain your problem and this is a C program not a C++ program, so post it under the correct forum.

Member Avatar for stilllearning
0
160
Member Avatar for Se7Olutionyg

Well in your function declaration [icode] float computeNet (money); [/icode] money is not a recognized datattype. Its probably your variable name. You probably want [icode] float computeNet (float money); [/icode]

Member Avatar for stilllearning
0
213
Member Avatar for plike922

Does your code compile ? One thing I notice is that [icode] bool space=true;[/icode] .. bool is a C++ data type.

Member Avatar for Aia
0
98
Member Avatar for RayvenHawk

I am going to try to answer this, but I don't completely understand your problem. Your function s_display() will process the stack routine and then return back to the switch statement in your main(). If you want to continue asking the user to process a different data structure type after …

Member Avatar for RayvenHawk
0
205
Member Avatar for tones1986

A fairly simple explanation of how you can use the sieve of eratosthenes [URL="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes"]here[/URL]

Member Avatar for skatamatic
0
430
Member Avatar for Hacker_517

Use a structure [icode] struct familyRecord{ char* name; char* birthDate; int isMarried; int nChildren; . . . }; [/icode]

Member Avatar for Clockowl
0
109
Member Avatar for mehtaneha84

I am really not sure why you have your class files in packetstructure.cpp. The declarations should be in a file called packetstructure.h As said before, you need to include packetstructure.h in fifoqueue.h, and then include fifoqueue.h in main.cpp and fifoqueue.cpp. The cpp files only need to reference your definitions, so …

Member Avatar for Sci@phy
0
181
Member Avatar for DanDaMan

That is how you include the header file. You will also need to include <iostream> in your Pen.h files since there are some print statements cout in there. So you may want to move that to the Pen.h header file.

Member Avatar for DanDaMan
0
144
Member Avatar for andyT

You cannot use the overloaded operator = to directly assign a vector to an integer array. The = operator is overloaded to allow you to assign one vector to another vector. This is the protoype : vector operator=(const vector& c2); In your case you will probably need to loop through …

Member Avatar for andyT
0
227
Member Avatar for launic

A tutorial that may help [URL="http://mrbook.org/tutorials/make/"]here[/URL] I would suggest downloading the Makefile copy and then making your changes to the existing Makefile. That is always the easiest way to make sure you do not mess up on the tabs !

Member Avatar for stilllearning
0
97
Member Avatar for aoi

I think what you are trying to do is insert values in a doubly linked list in alphabetical order by the last name ? if so, you aren't going about it correctly .. lets assume you have a set of 5 elements you want to insert in the list; We'll …

Member Avatar for ahamed101
0
109
Member Avatar for psyman_86

What you are doing will work i.e. RF_RXTXPAIR_SETTINGS code RF_SETTINGS[2]; If you want to dynamically assign an array size at runtime, you could do RF_SETTINGS = malloc (number_of_elements * sizeof(RF_RXTXPAIR_SETTINGS));

Member Avatar for Salem
0
156
Member Avatar for nizbit

That shouldn't matter. As long as your declare your your strings using the type "string", you will be able to store a string of any length for your string values. This is completely independent from your declaration of a Contestant object.

Member Avatar for grumpier
0
102
Member Avatar for slayman89

I ran your code and it works fine. I would suggest a couple of things. "list" is a reserved STL container so you may want to call your variable something else. And your loop should be [icode]for (int i = 0; i < list.size(); i++)[/icode] ie < not <= . …

Member Avatar for slayman89
0
250
Member Avatar for vrga

What does the sample data in your file look like ? Regarding your code, you need to be careful about the loop which is reading from your file. Unless your total number of records in the file is a multiple of 9 you will not read the values into the …

Member Avatar for vrga
0
115
Member Avatar for gangsta1903

So that you can obtain a certain level of protection. For example, You have an input data file with sensitive information and you don't want anyone to modify it. You can write a function that accesses and reads from the file using an ifstream file pointer, but if the caller …

Member Avatar for gangsta1903
0
137
Member Avatar for TooMpa

Yeah it should be "t:" and if t is an optional argument it should be "t::" why don't you like getopt ?

Member Avatar for ssharish2005
0
166
Member Avatar for bone7_7

I agree.. this is painful .. To add to what Sci@phy told you, take a closer look at this [icode] float calculate_mile_per_hour(float miles, float minutes); { float mile_per_hour; miles_per_hour = (miles * 60)/minutes); return (mile per hour); } [/icode] First of course, remove the semi-colon from all of your function …

Member Avatar for bone7_7
0
208
Member Avatar for Strat79

You could try using valgrind on Linux to see if you have any memory errors. See [URL="http://valgrind.org/"]http://valgrind.org/[/URL].

Member Avatar for ahamed101
0
238
Member Avatar for Hinche4

Its already 3 hours past .. but here are a couple of things I see Your screen.h file has [icode]#ifndef SCREEN_H #define SCREEN_H #include "Screen.cc"[/icode] And your screen.c file has [icode] #ifndef SCREEN_H #define SCREEN_H #include "Screen.h" [/icode] .. not a good idea imo. I would suggest removing the "#include …

Member Avatar for Hinche4
0
302
Member Avatar for san_sarangkar

main() is the point of entry to your program .. so there is no way around it. I am not even sure why you want to do this ?

Member Avatar for ArkM
0
322
Member Avatar for stilllearning

As long as we are on multithreading, I have a question too .. I basically have a implementation of pthreads on Linux and I want to port it to Windows .. I have read a bunch of docs on how to do this, but I also came across the pthreads-win32 …

0
77
Member Avatar for saulzi

Are you looking to understand how the variable argument list works ? If so read [URL="http://bobobobo.wordpress.com/2008/01/28/how-to-use-variable-argument-lists-va_list/"]this[/URL] ...

Member Avatar for stilllearning
0
153
Member Avatar for programmergirl

You need to give us more information. Can you post the link errors that you get ? Make sure that you have the correct prototypes in the .h files and that you are including the correct .h files in main and your .c files.

Member Avatar for Sci@phy
0
275
Member Avatar for Jennifer84

I don't know about C++, but in C you can use the function fcvt .. which I think is faster than sprintf . See [URL="http://www.mkssoftware.com/docs/man3/fcvt.3.asp"]here[/URL]

Member Avatar for mitrmkar
0
154
Member Avatar for mac1234mac

I will try to answer these .. but I'd suggest looking them up online also. 1. #pragma is a compiler directive. For example #pragma pack(n) .. specifies the packing alignment for structures and unions (ie 1 byte boundary, 4 byte boundary and so forth). [URL="http://dn.codegear.com/bg/article/21943"]here[/URL] is some more information. 2. …

Member Avatar for stilllearning
0
168
Member Avatar for Yuruke

Lets assume you have Stack1 (push_back, pop_back) and Stack2 (push_front, pop_front) Say you want to enqueue 1,2,3 Lets enqueue the numbers onto Stack1 using push_back Stack1 looks like : back |3|2|1| front Stack2 looks like: back |EMPTY| front Now you want to dequeue a number. So lets pop_back all the …

Member Avatar for stilllearning
0
119
Member Avatar for NRaf

As you can see from your messages, your code is segfaulting inside one of the std::string operator = overload functions, which in turn calls strlen. A segfault is usually an access violation, ie you are writing to or reading from memory that is beyond what has been allocated to you. …

Member Avatar for Salem
0
3K
Member Avatar for Kidd87

Please use code tags to make your code easier to read. Your function prototype .. int delfn(acmetype *&head) .. doesn't make any sense. You probably need something like .. I am surprised your code compiles :?: [icode] int delfn(acmetype *head) [/icode] In your statement "if( nnptr->link == NULL )" .. …

Member Avatar for Salem
0
219
Member Avatar for Jennifer84
Member Avatar for Jennifer84
0
7K
Member Avatar for rbaena

Well looks like you have the function getframe0() defined twice in the files getframe1.c and getframe0.c And you don't have the function getframe1() defined anywhere. I think what you want to do is rename getframe0() to getframe1() in getframe1.c ?

Member Avatar for rbaena
0
79
Member Avatar for scholar

check out this thread [URL="http://www.daniweb.com/forums/thread147354.html"]here[/URL] ... and see if you can find what you need.

Member Avatar for stilllearning
0
130
Member Avatar for mauro21pl

gcc allows the // comments. The only compiler I have come across which doesn't allow // on C code is the AIX C compiler.

Member Avatar for stilllearning
0
87

The End.