1,608 Posted Topics

Member Avatar for Gagless

Given: x == 2 or F(2) I'll rewrite it as (F(1) + F(-1)) which I'll rewrite as ((F(0) + F(-2)) + 3) which I'll rewrite as ((3 + 3) + 3) which is 9 Given x == 3 or F(3) OR (F(1) + F(0)) OR ((F(0) + F(-2)) + 3) …

Member Avatar for Gagless
0
119
Member Avatar for abbasi89

Welcome to DaniWeb. You should be aware that doing homework for someone else is discouraged, though occasssionally someone gets lucky. Based on the stated requirements you have a wide array of options. Since I don't know what you know it's hard to say what might work best for you. Arrays …

Member Avatar for mitrmkar
0
202
Member Avatar for monkey_slap

First, you appear to be trying to accomplish this task as though a list is an array, but they aren't the same thing. Swapping (multiple) nodes in a list is very inefficient. Don't do it, even if you could figure out how. To insert a new node at any desired …

Member Avatar for Lerner
0
173
Member Avatar for buddy1

1) void binaryAddint* result, int&cBit, const int* bin1, const int* bin2 ); You are missing a ( in there somewhere, probably between Add and int. 2) define carry to be an int, not an int array, and initialize it to zero 3) You are defining binaryAdd() within main() rather than …

Member Avatar for buddy1
0
265
Member Avatar for fox51

why do you need a multimap and not a vector of strings? I doubt you're going to save any time by using a map. It's also not evident why you need the line number to do this, either. An STL string is nothing more than a glorified C style string. …

Member Avatar for fox51
0
165
Member Avatar for latour1972

You need to list header file names, not just the preprossor command include. You may need to include a statement regarding namespace std depending on your compiler. main() should always have return type int, not void. I've never tried to output a string literal equal to this: "&". If that's …

Member Avatar for henpecked1
0
137
Member Avatar for iammop

I have no idea what language the original is, but here's a guess as to what it might mean in C++ pseudocode:[code] Declare a function called IsTextFile that takes a single argument of type string called FileName and returns type bool. In the body of the function do the following: …

Member Avatar for Ancient Dragon
0
120
Member Avatar for pooh2008

>>PLEASE HELP!!!! Post code using code tags, include a description of the problem you're having, etc.

Member Avatar for Lerner
0
147
Member Avatar for rem0404

Since title, price and publisher are declared with private access within the class the << operator will need to use public accessor methods to do it's job unless it is declared as a friend function within the class.

Member Avatar for Lerner
0
109
Member Avatar for dark_ivader

1) To use std::strings in your program use this line: #include<string> not this: #include<string.h> The latter is a deprecated file for functions to manipulate C style strings. 2) if arrayToClear has capacity of lengthOfArray then the largest valid index for an element of arrayToClear is at lengthOfArray - 1. That …

Member Avatar for Lerner
0
113
Member Avatar for potentialdesign

The terminology used in programming is something that still baffles me at times. What exactly a C++ interface is is one of those terms. On the one hand, C++ interface cam mean how the program presents itself to the user, not with whether the program is started from the command …

Member Avatar for potentialdesign
0
118
Member Avatar for CodeBoy101

Only if the file is highly structured. seekg and seekp will position the file pointer at a specified number of bytes from the beginning of the file, but unless each line has exactly the same number of bytes, trying to place the pointer at the start of the desired line …

Member Avatar for CodeBoy101
0
144
Member Avatar for Raptoricus

strings can hold space char and other whitespace char as well, once you know the details of how stream methods and overloaded operators work. Short story, use getline(), there are two versions, one for C style strings and one for stl string objects.

Member Avatar for Radical Edward
0
171
Member Avatar for scarface3288

Try this: ifstream input("infile.txt") while(input.getline(file,100)) { outputfile<<file<<endl; } ios::in is the default for ifstreams so it's not needed. I can't say for sure but I bet the inflie.good() suffers from the same problem as !infile.eof() snippet that many peolp try, given it has the same outcome.

Member Avatar for scarface3288
0
87
Member Avatar for tones1986

You are missing a & in the definition. The return type in the declaration is const BSTree<T>& but in the definition its const BSTree<T>

Member Avatar for tones1986
0
92
Member Avatar for DJPlayer

>>I figured maybe I could find a semi young experienced programmer w/ some time on their hands... Good luck >>to step me through some of my stumbling blocks The board policy is to help/encourage but not do and our advice is offered publicly, not privately. After all, if I steer …

Member Avatar for ithelp
0
113
Member Avatar for nurulshidanoni

>>how to call the input file that i was read into selection sort? Pass both Id and total to selectionSort() function, instead of just a one array. To sort by the values in Id use Id in place of array in selectionSort(). Then, every time you swap elements of Id …

Member Avatar for nurulshidanoni
0
3K
Member Avatar for pakman31

>> Do you ever find a good occasion to use eof () Do you ever use it as part of a validation sequence? Specifically, if you read the file with this: while(fin >> sample) how do you know why the loop terminates? That is did the loop terminate because the …

Member Avatar for Ancient Dragon
0
6K
Member Avatar for alkeshtech

Did you write the file? Can you get the desired char to appear in you C++ program? If you can get the desired char to appear in you program try outputting the char to the screen but cast it to an int in the process and see what the value …

Member Avatar for Ancient Dragon
0
130
Member Avatar for jimJohnson

6, 5, 11, 10, 4, 8, 9 each number in that sequence is 3 more than each number in the following sequence 3, 2, 8, 7, 1, 5, 6 which means you increased the value of each element in num[] by 3 not the index used to access the values …

Member Avatar for Ancient Dragon
0
84
Member Avatar for hezfast2

>>getline(infile, ordered, mPrice, sPrice); To my knowledge there is no version of getline() that takes four parameters, and no version of getline() that stores information in ints or doubles. To my knowledge getline() is only for strings . Therefore I'd suggest a series of three calls to >> to obtain …

Member Avatar for VernonDozier
0
222
Member Avatar for ThunderSnow

multiset::multiset( ); The above is a default constructor. It should initialize any member variables to a default value, if they need one. Vectors don't need to be set to a default value and they are the only member variables I see, so none are needed that I can see. Therefore …

Member Avatar for Lerner
0
84
Member Avatar for Moporho

remove the single quotes from around the digits in the case statements. What you have are chars not ints. x is an int so use ints. case 1: not case '1':

Member Avatar for Moporho
0
113
Member Avatar for Erdnase

Line 56 is a function prototype, not a function call and needs to be fixed. On line 19 library is declared to be an array of type pointer to type book. Therefore each library[m] will be a pointer to a book object. Hence to access the members of the book …

Member Avatar for Erdnase
0
118
Member Avatar for tm5054

1) Add a line like: const int MAXIMUM = 100; at the start of main(). 2) Remove MAXIMUM from the prototype for findMe 3) Be sure the number of parameters for findMe() are the same in the declaration and the function call---as posted they aren't. 4) You don't check for …

Member Avatar for Lerner
0
133
Member Avatar for xtheendx

Look at the last function you wrote before compiling for the last time. Assuming there were no errors before writing that function then the errors should be somewhere therein. If you didn't compile until after you wrote all of that, then shame on you. You can work it out yourself …

Member Avatar for Lerner
0
1K
Member Avatar for rem0404

There are two basic errors in the following snippet:[code] else titles[i] = ' '; artists[i] = ' ';[/code] First, lines two and three are supposed to be done every time the else is invoked, but only if the else is invoked. With the code as it stands that won't happen …

Member Avatar for Lerner
0
103
Member Avatar for CodeBoy101

look up the various versions of getline(). There's one for C style strings and another for STL string objects.

Member Avatar for zandiago
0
114
Member Avatar for mussa187

1) "where can I add the ip and the uri?" I'm not sure exactly you mean by that question. It is possible, but ungainly, to have the user enter (add) all the data needed as input for the program from the command line. It is more common for the program …

Member Avatar for Ancient Dragon
0
114
Member Avatar for rem0404

You are adding empty strings to the back of the file, not overwriting the desired values by assigning empty strings at the desired index within the vector. For what it's worth I'd suggest using the erase() method of the vector class to remove the entries completely.

Member Avatar for rem0404
0
80
Member Avatar for rem0404

If I'm not mistaken the default behaviour of ofstreams or ios::out mode of fstreams is to overwrite the existing file.

Member Avatar for Necrolis
0
172
Member Avatar for nurulshidanoni

Here's an example based on your code that may help:[code] void sortData(int lId[], int fId[], int noOfRows); int main () { int lId[4]; int fId[4]; while (inFile >> fId[i]) { inFile >> lId[i] ; i++; } sortData(lId, fId, i); for (i = 0; i < 4; i++) { outFile << …

Member Avatar for nurulshidanoni
0
83
Member Avatar for orangejuice2005

It looks like you are trying to use the << operator to print out something that doesn't have the << operator overloaded for it within the printHashMap() function.

Member Avatar for orangejuice2005
0
71
Member Avatar for LindseyV

A quick problem I see is this: if (function == "fifo" || "lru" || "opt" || "clo") It should be this: [code] if (function == "fifo" || function == "lru" || function == "opt" || function == "clo") [/code]

Member Avatar for Lerner
0
352
Member Avatar for programmer01

Welcome to Daniweb! When posting code to this board please enclose int in code tags. You can read about code takes by reading the watermarks that appear in the message box where you enter the information that you want to appear in the post or by reading the anouncement section …

Member Avatar for Lerner
0
212
Member Avatar for chocl8drop

>>Do I need to keep the current functions and add functions such as Only if you want to or need to. But, since you declare and define a non-default constructor you should write a copy constructor, and it would be a good idea to write a default constructor as well. …

Member Avatar for Lerner
0
386
Member Avatar for rem0404

The most important thing about using files is you need to know exactly how they are set up. In this case, presumably the title, artist and song are delimited by something other than space so spaces can appear in the name of each field. Maybe the delimiter is a ~ …

Member Avatar for Lerner
0
127
Member Avatar for tones1986

1) You have to decide what you mean by making a copy. Since you have pointers within the node objects making up the list/deque if you do a shallow copy then each copy is using the same memory and if one copy is destroyed then the memory for all copies …

Member Avatar for Lerner
0
148
Member Avatar for h0neydip

The spin could readily be represented by a loop that advances a pointer starting at a given location certain number of times. I'm less certain how you will determine how many nodes there are to be in the wheel.

Member Avatar for Lerner
0
147
Member Avatar for Princequarles

Please use code tags when posting code to this board. You can read how to use them in the watermarks of the message box or in the anouncemts at the top of the board. main() has return type int. You haven't given it any return type at all. I hope …

Member Avatar for Salem
0
107
Member Avatar for mr.cool

On line 6 movem is declared as a two dimensional array of type char meaning each movem[a] is a string and each movem[a][b] is a char. strcpy requires two char *s, or strings if you prefer, so passing movem[i] as in line 9 is correct but passing movem[1][i], a char, …

Member Avatar for mr.cool
0
102
Member Avatar for complexcodes

SavingAccount account1(2100); That is a constructor using an int. Unfortunately, you don't declare such a constructor, so the compiler is complaining. Unfortunately, the compiler thinks you are trying to use the copy constructor, so it's giving you a funny reason for complaining.

Member Avatar for Lerner
0
112
Member Avatar for Cosa

I suspect there's a reason why readmatrix has a return type of float*. I'd consider using the return type back in main() by declaring a float * in main() that can accept the pointer value returned and can then pass it to printmatrix(). For thouroughness sake I'd also delete the …

Member Avatar for Cosa
0
241
Member Avatar for xm1014

I usually try to write things down on paper before trying to write code. In this case I would probably start with something like this:[code] Goal: Create an unbalanced binary tree starting at root If br value less than root value add br to left child else add br to …

Member Avatar for Lerner
0
73
Member Avatar for anbuninja

Looping just means do the same thing one or more times. So if you can write code to determine if a given char has a given value, then you use that in a loop using a counter to determine how many of a given char there are in a given …

Member Avatar for hacker9801
0
124
Member Avatar for Gresakl

Variables can be passed by value, in which case a copy of the value of the number is passed, not the number itself; or it can be passed by reference, in which case the number itself is passed. If passed by value then the value of the original variable in …

Member Avatar for Lerner
0
1K
Member Avatar for rsuh2000

Welcome to DaniWeb. Please learn to use code tags when posting code to this site. See the watermark in the posting window or the announcement section at the top of the board to learn how. First I think you need to determine whether the char need be case sensitive or …

Member Avatar for Lerner
0
209
Member Avatar for didi00

For the list problem--- 1) the compiler/linker need to have seen at least the prototype, if not the whole definition, of a function before it is called. Since the compiler/linker start at the top and work down, that means the prototype, if not the whole definition needs to occur before …

Member Avatar for Lerner
0
100
Member Avatar for mnv29brt

There are several ways to do it, but you may have to redo some members of the Polynomial class. Here's one possible way to approach it. If the coeffiecent vector contains zero at appropriate element at the power of the variable, then just extend the coefficient vector by adding the …

Member Avatar for dougy83
0
4K
Member Avatar for veronicak5678

Create 4 files:[code] file #1: BookInfo.h #include <string> using namespace std; class BookInfo { private: string author; string title; string publisher; string isbn; string date; public: BookInfo(); ~BookInfo(); //accessors and mutators void setAuthor(string); void setTitle(string); void setPublisher(string); void setIsbn(string); void setDate(string); string getAuthor(); string getTitle(); string getPublisher(); string getIsbn(); string …

Member Avatar for veronicak5678
0
150

The End.