1,608 Posted Topics

Member Avatar for pudge343

I'm sure there are multiple definitions of what a sentinel is, but I think of it as something that triggers an action. For example, if I want to do one thing if the variable called changeFunctions is true and another thing if the changeFunctions is false, then changeFunctions could be …

Member Avatar for Schol-R-LEA
0
253
Member Avatar for physicist

The syntax is either way off for C or so confuscated as to be unreadable. Semicolons are missing or misplaced. It's hard to tell if there are function declarations or variable declarations. Etc.

Member Avatar for Schol-R-LEA
0
416
Member Avatar for eshalmj

First things first. Even if your code doesn't explicitly need it you should (almost) always have a default constructor in addition to any non-default constructors in your class. If you don't know what the declaration of a constructor looks looks like I suggest looking at your notes or class reference. …

Member Avatar for divyakiran
0
888
Member Avatar for woody363

I don't routinely program in a graphics environment (to make pictures, lines, objects, etc), but when I do program in a graphics environment I use OpenGl. There are multiple online sources for assistance (nehe.gamedev.net is one nice resource) and by typing in install OpenGl in Google I get multiple hits, …

Member Avatar for woody363
0
296
Member Avatar for lolwut25

Surprisingly enough, the vector class has a method, it's called erase(), that allows you to do just that. If you plan on writing code and using vectors I'd encourage you to get a reference that you can use to help figure this type of question out. cppreference.com is one such …

Member Avatar for Lerner
0
2K
Member Avatar for BenjaminH

You seem to have some trouble switching back and forth between STL string objects and C style strings (null terminated char arrays). I'd use one or the other for this project. You can use the [] opoerator on an STL string to acceass any givenn char therein. The STL library …

Member Avatar for Lerner
0
148
Member Avatar for smmcfarl

First make sure the constructors and output functions work right. Then test the input functions. Then test each of the math functions separately, adding each to a menu/switch as you call them.

Member Avatar for Lerner
0
173
Member Avatar for pingpongplaya

int coeff[0]; declares an array with capacity to hold no ints. If you want to be able to specify how many coefficients will be in coeff at run time then you need to declare coeff with enough capacity to hold the largest number of coefficients an end user could possibly …

Member Avatar for pingpongplaya
0
4K
Member Avatar for PrimePackster

WaltP is being (a bit) sarcastic (OP did indicate problem was in the sum() function), but he has a point. Many IDE programs will help you narrow down the problem line by indicating what line they think the problem is in, and if yours doesn't, then commenting out the lines …

Member Avatar for PrimePackster
0
103
Member Avatar for C++isC++

Honesty is always a good policy. So, I'm sorry, but the answer is no. Please see the homework policy at the top of this board.

Member Avatar for MandrewP
0
103
Member Avatar for Jdan2388

1) int anArray[499]; That declares an array of 499 ints with valid indices of 0-498. If you want an array of 500 ints you should declare it like this: int anArray[500]; 2) In Driver.cpp lines 20 and 21 try to declare functions within main() which is a no no. To …

Member Avatar for Lerner
0
256
Member Avatar for jmaass20

C++ is case sensitive so bankaccount is not the same as BankAccount. In the .cpp file (if you are using files to keep track of things) you implement the class functions (class methods if you prefer that syntax) declared in the .h file. If you are implementing constructors or destructors …

Member Avatar for Lerner
0
137
Member Avatar for codenoobrebel

Ok, so I don't have compiler where I am, and even if I did, I don't have your .dat file, or an example of the information therein, so I couldn't test your program even if I did. Having said that I offer the following: 1) Don't use the output of …

Member Avatar for Lerner
0
108
Member Avatar for eRayven38

find position n - 1. Call it temp. Then write a function that returns nothing, takes no parameters, and deletes temp->next, as long as temp->next isn't NULL.

Member Avatar for deepu.sri24
0
1K
Member Avatar for christine.j

if k is controlling the index of the array you are using (lines 20 and 21) then why do you keep setting the value of k to either 1 or 2 in lines 28 and 30?

Member Avatar for raptr_dflo
0
1K
Member Avatar for jmaass20

A menu is often a set of choices, like enter + to add 2 numbers , enter * multiple 2 numbers, etc. printMenu() would print out all the options you want the user to have. If your instructor has given you a specific menu to construct, use it. If not, …

Member Avatar for raptr_dflo
0
123
Member Avatar for daldrome

Try using another variable, say k, to keep track of the current "size" of the shape whereas n is the maximal size of the shape. Set k = 1 before the second do while loop, change the i <= n to i <= k in the for loop, increment k …

Member Avatar for daldrome
0
198
Member Avatar for dakerao

Please be more specific in the description of what you are trying to do. The way I read the first sentence it looks like you want to find a set of characters in a text file, say all the vowels in a piece of text like "eenie meenie minie mo". …

Member Avatar for Lerner
0
199
Member Avatar for wfws

Post only the code you think is relevant to a specific question. If a respondent feels more code would be helpful then they will likely ask for it. One on one tutoring is not the goal of this site, though there may be such sites available on the web. The …

Member Avatar for gusano79
0
100
Member Avatar for stevo7624

I erased my original post because I neglected to check page 2 of the thread. make_pizza(char variety, int n) sounds like you need to add_flour(), add_pepperoni(), add_vegetables(). The amount of flour, pepperoni and vegetables you need to add will probably depend on the values of those ingredients associated with the …

Member Avatar for raptr_dflo
0
133
Member Avatar for maple123

1) Use an fstream in in mode or a dedicated input stream called and ifstream. 2) A given linked list represents a given polynomial. Each node in the linked list represents a term of the polynomial (a term means a coefficient a variable and an exponent of form cx^e). The …

Member Avatar for raptr_dflo
0
739
Member Avatar for khevz09

Use a loop printing one space to the screen each time through the loop. When you are done with the loop it will look like you printed a string of spaces all at once. As an alternative to doing everyting on the fly you could use two arrays (tables) of …

Member Avatar for cejay2b20
0
1K
Member Avatar for ixmike88

First things first. Welcome to Daniweb. Your ability to post code with code tags on your first post puts you at the head of the class! Having said that, there are a couple things I would suggest. #1) When writing code using standard C++ try to avoid using global variables. …

Member Avatar for coltonbyu
0
837
Member Avatar for Anuradha Mandal

j is incremented by one each time through the loop. On line 11 is the instruction to break out of the loop if j is over 12. So it seems like the code is doing what it has been written to do.

Member Avatar for WaltP
0
137
Member Avatar for DotNetUser

This is dependent on the platform you are writing your program for, Windows/Linux/Mac. There are forums for this indiviual platforms if you go to the forum index and scroll down a ways. You may get an answer here, but you are much more likely to get a response in the …

Member Avatar for pixma
0
224
Member Avatar for btowne2

Unless you are using somebody elses program you can't do standard deviations by just turning on the computer. Someone needs to write a program to do it. In this case it's you. One of the useful tools in writing programs is to recognize patterns. Another is the ability to break …

Member Avatar for Lerner
0
192
Member Avatar for shadowscape

You need to be much more specific with your request. Are you trying to make a 25 char string using 5 separate, unrelated 5 char substrings? Can the substrings be of variable length as long as the total char in the string is 25? What characters are valid to use? …

Member Avatar for rubberman
0
155
Member Avatar for israruval007

Your objective isn't very clear. Where does the array called table come from? I assume it's an array of type info, but I don't see any declaration. I assume you want to print out the contents of table so that the information printed to the screen looks like the file, …

Member Avatar for Lerner
0
157
Member Avatar for TheSassyDragon

char * longInt = new char[x]; Now longInt is a char pointer pointing to the first element of a container of x number of elements of type char. That means that longInt acts like an array, though technically it isn't an array, but that is a discussion I still don't …

Member Avatar for Lerner
0
290
Member Avatar for loafie55

Your problem would be easy to solve with structs/classes, but it is doable even without them. Let's say each waiter could have up to 25 orders at any one time. Each order could have a customer identifier (seat number, customer name, whatever) and each customer could purchase one or more …

Member Avatar for loafie55
0
3K
Member Avatar for Theisonews

I can't explain the exact cause of your error message or why it complains the way it does. I can tell you that binary_search() takes either 3 or 4 parameters. The first is a location to start, the second a location to stop, the third is a single value to …

Member Avatar for Lerner
0
122
Member Avatar for cafegeo

You appear to have two arrays, one with the name of the product/item and the other with quarterly prices. The row index of the prices is the same as the index for the product name. In mice() you want to evaluate the data for each product. In order to do …

Member Avatar for VernonDozier
0
2K
Member Avatar for ichigo_cool

I would have thought that using this input: 1, with this syntax: fin >> a[i][j]; where a[i][j] is an int would result in fin going into an error state and that the stream would need to be reset/clearred before the char, the comma, that caused the error could be ignored. …

Member Avatar for ichigo_cool
0
4K
Member Avatar for Muhammad Anas

There are several ways. Since the space char is a character, notated like this: ' ', you can look for it directly. Otherwise you can use a function related to isalpha() called isspace(). However, isspace() looks for all whitespace characters, which includes the space character as well as the tab …

Member Avatar for Narue
0
2K
Member Avatar for C++ Beginner

Notice the different placements of the curly brackets betweenn the code written by Clinton Portis and your code. He checks the value of counter within the while loop to start a new line if needed, you check it outside the while loop. Try this:[code] #include iostream using namespace std; int …

Member Avatar for furyrichie
0
2K
Member Avatar for programing

In addEnd() assign address for the new node to q, not current. Be sure to assign y to q and to make each pointer in q NULL before adding it to tail. If head == NULL then assign q to head and q to tail and you're done for that …

Member Avatar for Lerner
0
139
Member Avatar for BurgerBob

As far as I can tell this should be the basic logic for the program [code] main() int balance int wager bool oneMoreGame while(balance above zero and oneMoreGame) enter wager check if wager less than balance and redo wager until it is gameResult = runGame() if gameResult is lost deduct …

Member Avatar for BurgerBob
0
676
Member Avatar for lukemuller

You could create a passenger class with just a string object, ie a name. Then you could have a seat class which has several variable members including a passenger, a row number, a seat number and a char to keep track of whether the seat is occupied or not. Lastly …

Member Avatar for lukemuller
0
2K
Member Avatar for osirus0830

The new operator returns a pointer (address) of the object(s) that memory has been allocated for. That pointer must be stored someplace in order for it to be gain access to the memory. When the [] operator is used to allocate memory for a group of objects then memory will …

Member Avatar for osirus0830
0
184
Member Avatar for tometherton

>>I can't work out how it would take value1+value3+value15 over just value1+value2. That should be doable by using two variables of type long to keep track of the closest value yet and the difference between the best yet and the target and a third variable that is an array of …

Member Avatar for tometherton
0
109
Member Avatar for keeda

But using tools when appropriate is an important skill to learn. Sometimes it's not appropriate to create classes or use inheritance if the problem can be better solved using other mechanisms, and to me, trying to force inheritance on a system that isn't suited to it doesn't help you learn …

Member Avatar for Fbody
0
270
Member Avatar for hawita

A stack is a virtual container that behaves something like an array but has restricted, instead of random access, to whats inside. The first thing you need to be able to do is be able to identify separate words (also known as tokens or substrings or whatever). Using the enter …

Member Avatar for hawita
0
138
Member Avatar for bgolub91

Think of the plot mathematically as an x and a y component, but think of the plot visually (to print) as a series of lines of spaces and crosses. Fill a 2 dimensional array with spaces. Then add a cross to the cell that demonstrates what y would be at …

Member Avatar for Lerner
0
98
Member Avatar for cogitoergosum18

You need to write the code yourself. If you want to blow them out of the water then check if secondNo is zero and if so exit the program. If you want to be user friendly then you can detect that secondNo is zero and use a loop to continually …

Member Avatar for pseudorandom21
0
242
Member Avatar for alex1050
Member Avatar for alex1050
0
85
Member Avatar for jambul_16

Do you want to create your own operating system or do you want to something a little more simple, like implementing an inventory system or maybe a game like battleship? All of these, and many more, can be done with the tools you list. since none of us know what …

Member Avatar for rubberman
-1
107
Member Avatar for jshoot

I don't believe C++ allows type double to be the index of an array/vector, so I'm surprised that the posted code would compile. If c2 were of type int and you were to increment it's value by 1 starting at 100 and stopping at 499, then the code as posted …

Member Avatar for jshoot
0
273
Member Avatar for aaronmk2

Need more input. What is the declaration for the xCards? If they are Cstyle strings then you can't assign one to the other and if they are STL string objects then they won't work with strcpy(). For Cstyle strings there is a strcat() function that will concatenate one string onto …

Member Avatar for Lerner
0
110
Member Avatar for JordanHam

If each entry in the file is comma separated(every field separated by a comma, no new line char or other whitespace), then you can read the file using getline() with the comma char as the delimiting char to "find" each comma. After each read from the file into a string …

Member Avatar for JordanHam
0
4K
Member Avatar for chirag_mittal

Welcome to the Board! You're off to a good start with your first post. You figured out how to post code using code tags, you use consistent indentation, you have commented your code, and you asked a relevant question. Here are some comments: In general: 1) The return type of …

Member Avatar for chirag_mittal
0
1K

The End.