1,362 Posted Topics

Member Avatar for fiz

First, check your spelling. In line 26, you call function AddMatirix, which of course does not exist. Your function is written with two int parameters, i and j, which do not convey any information to the function, as written. Why not delete those parameters, declare loop variables in the function. …

Member Avatar for xavier666
0
105
Member Avatar for sneekula
Member Avatar for BenJammin89

First, the code would be clearer if your variable names better expressed what they were. What's "total"? The input of distance driven should be "miles", not "mpg". [icode]mpg = miles / gallons[/icode] better expresses what you're doing. The calculation of the mpg for a given tankful should occur inside the …

Member Avatar for BenJammin89
0
129
Member Avatar for Brandon515

What's the largest value that can be stored in a long int? How does that limit compare to the value you're trying to stuff into a long int?

Member Avatar for Brandon515
0
131
Member Avatar for jhanthem

[icode]results[0]= x * sin (x);[/icode] x is an array - it cannot be used as the operand of a multiplication nor as the argument to sin( ). Did you mean to say [icode]results[i]= x[i] * sin (x[i]);[/icode]?

Member Avatar for vmanes
0
165
Member Avatar for ukbassman88

> [Only] one declaration of the variables are needed. Either before main() or inside of main(), doesn't really make a difference, but only once is needed. Actually, it does make a difference. The declaration outside of main( ) is globally visible and modifiable. This is generally to be avoided, especially …

Member Avatar for vmanes
-1
79
Member Avatar for samsons17

switch blocks are not good for doing range based decision making. You have to be able to do exact matches to integral types, which is often, as you surmise, way too much work. Use if...else if... construct to separate your data points into the appropriate range groups.

Member Avatar for vmanes
0
128
Member Avatar for UKmason

Your new function, which still has the { } problem jonsca pointed out, will return immediately after the first number is read in, depending on whether it meets the 10-500 test or not. You should construct the loop to read in six times, and test if the new number is …

Member Avatar for jonsca
0
137
Member Avatar for niezam

I would do a search of the daniweb c++ forum and find this problem discussed many, many times. ( I wish profs would be a bit more creative and come up with some new assignments.)

Member Avatar for vmanes
0
122
Member Avatar for Renas

You need to write a couple of hand scoring functions. You don't look for all possible combinations, but look at a player's hand and determine what, if any, of the poker hands it constitutes. In evaluating a hand, you need to look at first the value of the cards, disregarding …

Member Avatar for Clinton Portis
0
188
Member Avatar for dylank

To read just 5 characters at a time to your array, you could use getline( ). Make your array size 6 to allow for the null terminator at the end of a string, then [code] char arr[6]; //open your filestream as shown in previous posting while( infile.getline( arr, 6 ) …

Member Avatar for dylank
0
195
Member Avatar for dzhugashvili

Visual C++ (other than the free express editions) can compile 64bit directly in the IDE. It does appear that you can compile from the Express edition, using command line compilation. See [URL="http://en.wikipedia.org/wiki/Microsoft_Windows_SDK"]here[/URL]

Member Avatar for dzhugashvili
-4
113
Member Avatar for iris88
Member Avatar for peacerosetx
Member Avatar for peacerosetx
0
207
Member Avatar for Cy137

What compiler/IDE are you using? That would help us to tell you where the input file should be located. Are you running this from the IDE or directly in a command window?

Member Avatar for vmanes
0
134
Member Avatar for gcardonav

[QUOTE=Ancient Dragon;529930] <snip> My suggestion to students is to ignore that warning message and use [icode]#pragma warning(disable: 4996)[/icode] to prevent the compiler from issuing it -- unless of course your teacher has instructed you to do otherwise.[/QUOTE] Or, follow the advice from M$ #define _CRT_SECURE_NO_DEPRECATE #define _CRT_NONSTDC_NO_DEPRECATE Use these #define's …

Member Avatar for seraph03
0
2K
Member Avatar for ge6a93

Long time ago I used [URL="http://msdn.microsoft.com/en-us/magazine/dvdarchive/cc301454.aspx"]this article [/URL]as a reference to do such. Unfortunately, it seems the supporting code is not available at this time, from MS. But, if you Google for "imageview" you will find the code posted in a few places. I like Mr. DiLascia's disclaimer [quote] If …

Member Avatar for vmanes
-1
121
Member Avatar for NICEGUY123

Here's your code, translated in to C++. [code] #include <fstream> #include <iostream> using namespace std; void READFile(char* filename) { int num; int color[100]; //make this large enough for any problem set int value[100]; ifstream inputfile; inputfile.open( filename ); if ( !inputfile ) { cout << "file not found, unable to …

Member Avatar for vmanes
0
442
Member Avatar for pman182001

[QUOTE=pman182001;1017994]I need help with IT210 week 7 programming problems 1 and 2 pseudocode can any one give some advice?[/QUOTE] Read the problem thoroughly. List what you know, what's to be input, what you're to do with it. Then start listing the steps to accomplish the task. Voila, you're done.

Member Avatar for mrnutty
-1
81
Member Avatar for sgour03
Member Avatar for Phil++

You could pass the username and password arrays (or the single array of user objects when you make a class) to the checkDetails( ) function. That way you don't have the arrays in global space (something we want to avoid) and the function will not be tied to any specific …

Member Avatar for vmanes
0
154
Member Avatar for Jalwes

I think a better approach would be just use getline to grab all of a line into a large string, then print out the first 22 characters that appear (or less if the line's not that long.) You can (with char array type strings) limit how much input getline will …

Member Avatar for csurfer
0
261
Member Avatar for program900

[QUOTE=program900;1017134] A function called “menu” that displays a main menu. This function should return the choice of the user.[/QUOTE] So, your function must: 1. Display the menu. What are the options in this program? 2. Ask the user to make a selection from the options available. Usually you will take …

Member Avatar for vmanes
-2
98
Member Avatar for Ancient Dragon
Member Avatar for clue.less

Please read the sticky threads about how to ask questions. Mainly, please put your code inside code tags so it will be more readable, like [noparse][code] your code goes here [/code] [/noparse] Big problem with your second sample is that you must reset j back to 0 after its while …

Member Avatar for Phil++
1
99
Member Avatar for rhukia

Please use this big white space to ask a question. If you read the sticky threads at top, you'll find useful information on how to ask questions here. It looks like you're writing in C, this is the C++ forum.

Member Avatar for vmanes
-1
30
Member Avatar for hla3mi

What I believe the problem is asking you to do is set up the 2D array. Read in the temperatures along the edges (is the temperature the same all along an edge or does it vary along the edge, particularly near the corners?) Once the edges are initialized, begin processing …

Member Avatar for vmanes
-2
268
Member Avatar for Triztian

Is your array declared as 5 columns or as 6? It makes a difference in the indexing you use. Are you using the row index as the student ID? I don't see input for IDs. Remember that the maximum index you can (safely) use is one less than the size …

Member Avatar for vmanes
0
115
Member Avatar for hopeful man

Well, I think an elegant solution would be a loop that iterates from -4 to +4, inclusive. Within that loop is another that uses the absolute value of the loop counter to print out the numbers and stars. But, it must account for the extra instance of 1 and the …

Member Avatar for mrnutty
0
108
Member Avatar for NinjaLink

Why are you doing two input actions in the loop? The first, in the while condition, reads the word and stops at the newline. The getline will read and discard the newline, storing an empty string to your variable. The doubled up bob is being caused by your not putting …

Member Avatar for NinjaLink
0
100
Member Avatar for haven_u

Depends on how easy you want to access the bits, and how you get the data. You could store the data as an unsigned char, and access each bit using masks. That easily handles single bytes. You could store the values 0 and 1 in an array of char or …

Member Avatar for vmanes
0
881
Member Avatar for martinandrade

Please read the sticky threads about using this forum, it'll make your time here more productive. Mainly, be sure to put your code inside code tags. This will make it more readable. When copying code from your text, be sure to copy it correctly. You have void Account::credit( int amount …

Member Avatar for martinandrade
0
952
Member Avatar for sneaker

Must have played it too much, dead link now. Sigh. Is [URL="http://www.transbuddha.com/mediaHolder.php?id=910"]this [/URL]the same thing?

Member Avatar for ayoungpretender
0
147
Member Avatar for A.Najafi

The error is due to the way floating point values are stored. Single precision, which it looks like you used, is only good to about 7 digits. Double precision will get you 15 digits. It's best to think of floating point values as approximations of the "real" value. See [URL="http://msdn.microsoft.com/en-us/library/47zceaw7%28VS.80%29.aspx"]here …

Member Avatar for A.Najafi
0
125
Member Avatar for newbie2c++

A. You are responding to a three year old post B. You are hijacking that thread with a new problem C. You are asking for a solution to a problem you have not attempted to solve on your own D. This is a C++ forum, you're asking for a VB …

Member Avatar for vmanes
0
900
Member Avatar for itzaaron

You cannot define a function inside another function. So, your main( ) must be closed [icode] return 0 } [/icode] before you start the definition of makeChange( ) Your technique of multiplying by number of coins in a dollar is unusual, but seems sound. In removing that coin's worth from …

Member Avatar for jbennet
0
167
Member Avatar for clearconcepts

That email link is a third party service, it simply forwards email independent of a mail service. Hmm, might be handy. To contact a DaniWeb member, click on their name in the upper left of the post and you'll get an option to send a private message, via DaniWeb.

Member Avatar for jbennet
0
156
Member Avatar for Fragmad

I think it has to do with the declarations of the items [code] Product milk = Product( "Milk", 7 , "Lot's of calcium"); [/code] Left side of the assignment operator creates the object. Right side of the assignment operator creates a temporary instance of the object, which gets assigned to …

Member Avatar for vmanes
0
94
Member Avatar for Dixtosa

A little searching effort on your part will get results much faster than just shouting out questions to the world. [URL="http://lmgtfy.com/?q=differences+are+between+c+%26+c%2B%2B"]Try this[/URL]

Member Avatar for Dixtosa
0
147
Member Avatar for adhruv92

You're kidding, right? Is it April Fool's day already? Read the sticky posts - we don't do your work, but we'll be glad to help once you've shown a reasonable attempt on your own.

Member Avatar for triumphost
-3
382
Member Avatar for genDisarray

As VernonDozier said, call srand( ) only once in a program. What happens, when you call it in the function as you did, and the function gets called repeatedly in a loop, the calls to srand( ) occur too quickly for the clock time to have changed, so you keep …

Member Avatar for vmanes
0
832
Member Avatar for Fragmad

I agree that your questions are valid, the little sample you provided is confusing. Could you post the whole of the main.cpp you were given, it might give us further clues as to what your prop expects. The only usage of line 5 I could imagine is if the class …

Member Avatar for vmanes
0
116
Member Avatar for triumphost

Your smaller code compiled fine in VC++ 2008 Express, once I commented out the [icode]#include "stdafx.h"[/icode]. Similarly, commenting out stdafx.h and a couple other minor changes to allow compiling as console app rather than a windows app, ( _tmain to main, TCHAR to char) it compiled, with some warnings. So, …

Member Avatar for triumphost
0
769
Member Avatar for UmH

for the general search function, take the [icode] else return -1 [/icode] out of the for loop. That return statement should only execute if you complete the for loop and don't find the search value. [icode]int ary[][/icode] does not have a length member. You will have to pass the array …

Member Avatar for vmanes
0
105
Member Avatar for sebassn

Do you mean to write a function that swaps two variables' values, and rounds to the nearest tens (not tenths, according to your example)? Or to just write code that does it in your main body? You'll use the same mechanism in either case. Do you know how to implement …

Member Avatar for vmanes
-2
96
Member Avatar for junioryz

If you know that the text file will be formatted EXACTLY as you show, then you can read and discard the first line (assuming the array size will not change). For the remaining lines, read and discard the first element, then read in numbers, discarding the commas. At its simplest, …

Member Avatar for K0ns3rv
0
146
Member Avatar for hur1214

Your second version is really not going to work - your swap portion only changes the assignment of the temporary pointers in the function, it does not change the ->next pointers in the actual nodes. More importantly, the return statement in the if block ends the function on the first …

Member Avatar for dkalita
0
93
Member Avatar for Kimmelivim

[code] for (i=1; i<=value; i++) { cout << "Enter some values: "; while (cin >> value) cin >> counter[i]; sum+= counter[i]; } middle = sum / value; [/code] Is this really what you mean to do? It doesn't make any sense. Did this even compile for you? (I don't think …

Member Avatar for vmanes
-2
114
Member Avatar for The Dude

Well, duh, we're here! 52 You are experiencing occasional or frequent problems because of the Internet. You should consider their full impact on your life.

Member Avatar for GrimJack
-1
133
Member Avatar for James19142
Re: c++

[QUOTE=James19142;1002843]What is the difference between a float & double value[/QUOTE] If this is a homework question, have you tried looking in your text? Otherwise, how about [URL="http://lmgtfy.com/?q=float+%26+double+value"]here[/URL]?

Member Avatar for James19142
-1
346

The End.