537 Posted Topics

Member Avatar for Jalwes

As soon as you said this: [quote] Could anyone tell me why this code read an extra line?[/quote] I immediately looked for this: [code] while (! in_stream.[COLOR="Red"]eof()[/COLOR]);[/code] This is a very common problem when testing eof() for an end of file condition. Instead try this: [CODE] //Test the return condition …

Member Avatar for Lerner
0
98
Member Avatar for cnote1287
Member Avatar for sexyzebra19

perhaps you could [URL="http://www.cplusplus.com/reference/clibrary/cmath/floor/"]floor() [/URL]the variable prior to testing for zero.

Member Avatar for Clinton Portis
1
204
Member Avatar for icygalz
Member Avatar for spear64

[CODE] //attempting to initialize with an uninitialized value out of bounds of the array int numOfStudents[100] = students; //function name spelled wrong acceptScores (numOfStudents); //Here you try to pass an array pointer to a function prototyped to accept an int acceptedScores (numOfStudents); //You should dereference the pointer to an int …

Member Avatar for Clinton Portis
0
132
Member Avatar for micke

I would make 'name' a char array (cstring): [CODE] //line #7 char name[80]; [/CODE] Now you can actually accept a name from the user: [CODE] //Line #32 cout << "Enter ye' name: "; cin >> name; [/CODE] Since you are using cstrings (character arrays) you should become very familiar with …

Member Avatar for Clinton Portis
0
201
Member Avatar for fliggygeek

From what I understand, an 'unsigned char' datatype will give you straight-up binary properties.. 8 bits, 1 byte, 0 to 255. [quote]My main task is to find a way of generating a boolean array of each character[/quote] I think a pseudo-code for the task at hand could be this: 1. …

Member Avatar for Clinton Portis
0
885
Member Avatar for n3r3d

I'm not sure what you are asking for, but I think you seem to be interested in preserving your white spaces. Try using getline(): [CODE] string line[50]; int pos = 0; int i=0; while(getline(datoteka, line[i])) { //Go back to the start of the line so you can extract data based …

Member Avatar for pecet
0
259
Member Avatar for Mariam786

Check this out: [url]http://www.daniweb.com/forums/thread240216.html[/url] [quote]Please help me in this program.My problem is that we are given that total budget of a game is 50000 but when the total expenses increases what should we do .....[/quote] You calculate a percentage of 50,000. Then it either falls into one of five categories: …

Member Avatar for Clinton Portis
-1
195
Member Avatar for kfg20

One way I would approach this, is not to worry about templating the function at all until you get a function that does what you want it to do. Once you got that down, you can easily go back and do all the necessary templating. With that said, just concentrate …

Member Avatar for Narue
0
653
Member Avatar for vinochick

After briefly looking at ye' code.. I would guess a displayPayment () would probably take place of everything going on between line #47 and #52.

Member Avatar for zortec
0
113
Member Avatar for Clinton Portis

A lot of people have questions about how to load a text file using file I/O. There seems to be 2 popular methods to loading a text file: Use fstream's >> extraction operator. Simple enough, load the file directly into individual containers, word at a time, but you lose your …

Member Avatar for mrnutty
1
195
Member Avatar for vinochick

Try this and see if it works: [CODE] //Line #6 void getAge(int&); //Line #24 void getAge(int& years) [/CODE]

Member Avatar for Clinton Portis
0
97
Member Avatar for ellimist14

You want to return the min and max gpa from your binary search tree. Q. Is your tree sorted by gpa? If so, (if ascending order), your lowest gpa would be on the lowest far-left node. Conversely, your high gpa would be on the lowest far-right node. If BST is …

Member Avatar for Intrade
0
138
Member Avatar for epicasian
Member Avatar for iman ata
Re: help

Check out this cool DOS tutorial [url]http://www.adrianxw.dk/index.html[/url] I believe you might specifically be interested in [URL="http://www.adrianxw.dk/SoftwareSite/Consoles/Consoles5.html"]part 5[/URL] which talks about keyboard and mouse events.

Member Avatar for Clinton Portis
0
660
Member Avatar for rafta

line #85, the name of one of your arguments is incorrect: [CODE] showArray1([COLOR="Red"]array1[/COLOR], SIZE); [/CODE] Also, just out of curiosity, why do you have two seperate functions to display an array.. it seems to me that one showArray() function could work for any array.

Member Avatar for rafta
0
111
Member Avatar for ninreznorgirl2

Anyone please feel free to chime in if you see anything wrong here: [CODE] //line #11 if(Temp -> Ch [COLOR="Red"][B]=[/B][/COLOR] CharToDelete) [/CODE]

Member Avatar for Clinton Portis
0
95
Member Avatar for javaconfused
Member Avatar for Clinton Portis
0
215
Member Avatar for javaconfused

Another good ol' database program. This calls for 'an array of structs' create your data type: [CODE] struct record { string description; int product_number; double unit; int sold; }; [/CODE] Now that you have designed your object, you need to create a bunch of them: [CODE] record database[100]; [/CODE] One …

Member Avatar for Clinton Portis
0
353
Member Avatar for reversed
Member Avatar for Clinton Portis
0
117
Member Avatar for mrPaul

[quote]it will say "scout arrived at 100,200" [/quote] After reviewing your loop, this seems to be the correct output in order to establish the terminating condition of your loop.. where toX == currentX AND toY == currentY... which will occur when toX becomes 100 (which is the initialized value of …

Member Avatar for mrPaul
2
107
Member Avatar for richman0829

I agree with twomers, using cin seems to be a 'safer' method than using [URL="http://www.cplusplus.com/reference/iostream/istream/getline/"]getline(), [/URL]in that cin will (unless something wack happens) will read in the entire input buffer while use of getline() will extract everything except the '\n'.. leaving it behind to thwart your subsequent attempts of reading …

Member Avatar for Clinton Portis
0
211
Member Avatar for nunchuckie

One thing I notice is that on line #48 you make this assignment: [CODE] b = a;[/CODE] and then on line #30 you totally undo the previous operation with each loop iteration: [CODE] b = start +i; [/CODE] So I'm not sure what you are trying to do, but something …

Member Avatar for mrnutty
0
153
Member Avatar for anbuninja

I believe that this may be related to your problem.. You are passing in objects to your functions 'by value' which necessitates the need to save a return value from your functions. [CODE] //you create this stuff int stoodunce[4]; char stoodunce1[4]; cfloat stoodunce3[4]; //and pass it into these functions 'by …

Member Avatar for jonsca
0
110
Member Avatar for turtlez

I believe that when it comes to bridging the gap between programming and the internet, people seem to recommend the use of [URL="http://msdn.microsoft.com/en-us/library/ms974283.aspx"]activex[/URL] [quote] ActiveXâ„¢ is a technology built on the Component Object Model (COM) that allows the developer to create objects or controls that can be used to "activate" …

Member Avatar for turtlez
0
116
Member Avatar for Ahmad Shaheen

What you are tasked to do is not really that difficult.. what part of the assignment is giving you the greatest difficulty?

Member Avatar for Clinton Portis
-1
151
Member Avatar for kryz

[quote]I'm confused with pointers. [/quote] pointer-type variables hold memory addresses.. just like int's hold integers, char's hold ascii values etc. [quote]I'm not sure how to get the vowels to show up in Case A[/quote] Although I do not agree with your current scheme of prompting for user input after a …

Member Avatar for Clinton Portis
0
789
Member Avatar for dchunt

In my opinion, I think it's possible to decompile an .exe into a somewhat hackish assembly code.... where if a person has a lot of time on their hands, could do a translation from assembly to a higher level lanaguage. (which of course, would probably not even be close to …

Member Avatar for kolosick.m188
0
107
Member Avatar for FanatiK
Member Avatar for ihtesham4deni

1. Create an ifstream object. 2. Create an ofstream object. 3. Attempt to open Expenses.txt using your ifstream object. 4. Perform error checking to see if Expenses.txt actually exists. 5. If file open successful, load file into a storage container of your choice (string, array of strings, or a vector …

Member Avatar for rahul8590
-1
259
Member Avatar for confusedndazed

You are right on brother. One suggestion: whenever you see a self re-assignment, you should have "compound operator" runnin' through your noggin' [CODE] y = y + 1; //is the same thing as y += 1; //The += operator signifies "accumulation" [/CODE] It's such a common task to re-assign a …

Member Avatar for rafta
1
124
Member Avatar for bigmaq

I'm not sure if this is related to your problem, but I'm pretty sure you aren't allowed to just declare arrays of a given size on demand: [CODE] cout <<endl<<"Please enter the size of the array you want to sort: "; cin >> mysize; //no bueno int mylist[mysize]; [/CODE] I …

Member Avatar for bigmaq
0
94
Member Avatar for the great

You are attempting to perform a switch test on a char[50] array. In c++, the switch structure is designed to perform tests on the current state of a single integral expression (the most commonly used are 'int' and 'char'). Additionally, even if you were testing the correct data type, the …

Member Avatar for Clinton Portis
0
95
Member Avatar for vinochick

Here is a possible pseudo-code for what ye' wish to accomplish: 1. Prompt the user for 5 numbers: [code] do{ cout << "Enter a number: "; cin >> user_picks[i]; i++; }while(i<5);[/CODE] 2. Ensure that user did not make a duplicate pick: [code] do{ cout << "Enter a number: "; cin …

Member Avatar for pecet
0
2K
Member Avatar for maverick405

[quote] But then how can i convert the grades to grades (letter) i.e. (a, b, c, c, or f)? I am still confused.[/quote] I'm not sure what you are trying to do, but maybe this will help: [code] //Function Prototype char get_grade(int&); //Display Grades for(int i=0; i<10; i++) { cout …

Member Avatar for maverick405
0
133
Member Avatar for wyett

[quote] I know I can use a search to find where the first instance of something happens, but how do I actually take whats before it?[/quote] I see that you seem to be interested in using [URL="http://www.cplusplus.com/reference/string/string/"]<string> class member functions [/URL]for your parsing needs. May I suggest the following which …

Member Avatar for wyett
1
114
Member Avatar for nitrogen33

As with any file I/O, I will need to see how your txt file data is formated.. white spaces and new lines are important factors to consider when trying to troubleshoot file I/O.

Member Avatar for Clinton Portis
0
77
Member Avatar for maverick0612

[quote] 3*-4. Any ideas around this?[/quote] In the evaluation of polynomial expressions, it is safe to treat all " - " minus signs as preceding negative numbers (it is safe to assume there is no subtraction). The only special case one must consider is the case of the double negative, …

Member Avatar for maverick0612
0
120
Member Avatar for squigworm

Try this funciton from [URL="http://www.cppreference.com/wiki/stl/algorithm/start"]<algorithm>[/URL] [CODE] #include<algorithm> int array[10000]; fill(&array[0], &array[10000], 0);[/CODE]

Member Avatar for mrnutty
0
243
Member Avatar for sameh_ba

Although I am by no means a network administrator, this assignment doesn't really seem that overly complex... H[URL="http://www.tech-faq.com/ip-address-classes.shtml"]ere[/URL] is how one can determine the IP class: [quote] [U]Class A[/U]: Class A addresses are specified to networks with large number of total hosts. Class A allows for 126 networks by using …

Member Avatar for sameh_ba
0
150
Member Avatar for AnnaHa

[quote]The problem is that the array size is unknown.[/quote] [CODE] int size = sizeof(array) / sizeof(array[0]); [/CODE] [quote]Is there any way to sort such an array without any lengthy procedures?[/quote] [CODE] #include<algorithm> sort(array[0], array[size]); [/CODE]

Member Avatar for Clinton Portis
0
75
Member Avatar for nguerrero03

Well, it certainly looks like you are on the right track.. well stated question and lots of code which shows effort on your part. You've created all the necessary objects with the required attributes and functions. You've created the dynamic arrays of these objects as per the requirement. Your menu …

Member Avatar for nguerrero03
0
543
Member Avatar for NitaB

[quote]and then could NOT figure out how to change the parameters of my doOneSet function to do addition, subtraction and multiplication[/quote] There are many ways to go about this. Since you seem interested in changing the parameter list of your doOneSet() function... maybe we could do something like this (ok, …

Member Avatar for AAAKsu
0
187
Member Avatar for konefsta

Just looking briefly, I see one error on line #14 of ergasia.h: [code] #define FILENAME "_filenames.txt"[COLOR="Red"];[/COLOR] [/code]

Member Avatar for jonsca
0
185
Member Avatar for kingstrider

This should give ye' at least an idea. I'll draw half of the hexagon, ye' can do the rest. This is untested, but feel free to tweak it as necessary to draw that perfect hexagon: [CODE] #include<iostream> #include<iomanip> void draw_hex() { //Draw Top cout << setw(10); for(int i=0; i<5; i++) …

Member Avatar for Clinton Portis
-2
88
Member Avatar for maverick405

[CODE] char ans = '\0'; int i=0; do{ cout << "\nEnter a number: "; cin >> arr[i]; cout << "\nWould ye' like to enter another number? (Y/N) "; cin >> ans; i++; }while((ans == 'Y' || ans == 'y') && i < SIZE);[/CODE]

Member Avatar for tkud
0
110
Member Avatar for IT seeker

What part of programming is specifically giving you difficulty? (please provide code with well-written question)

Member Avatar for ithelp
-5
221
Member Avatar for dylank

Try using getline(cin, user_input); edit: went to go take a wiz, when I came back ya'll had the answers already.

Member Avatar for dylank
0
162
Member Avatar for soccergad

You initialize all your string containers to 'white space' and your while() loop condition tests for 'white space' which will always test true (because at no time are they ever changed)

Member Avatar for AAAKsu
0
100

The End.