Search Results

Showing results 1 to 40 of 1000
Search took 0.09 seconds.
Search: Posts Made By: vmanes
Forum: C++ 1 Day Ago
Replies: 6
Views: 192
Posted By vmanes
Put a counter in the loop. Display the results before the function returns, or pass it back as reference parameter.
Forum: C++ 1 Day Ago
Replies: 6
Views: 192
Posted By vmanes
Proper indenting would help you find the error.

while (!found && first <= last)
{
middle = (first + last) / 2; // Calculate midpoint
}
if (array[middle] == value) // If value is found...
Forum: Windows Vista and Windows 7 1 Day Ago
Replies: 7
Views: 279
Posted By vmanes
I'm not sure how your question relates to the OP's problem. But, if you were handling multiple rows, which might have different states in each row, you simply copy this formula row to row, and Excel...
Forum: Windows Vista and Windows 7 2 Days Ago
Replies: 7
Views: 279
Posted By vmanes
Oh, it's not really that hard. You could do this if you were writing it in program code, and it's just a little jump to do it in Excel.

A cascading if...else block does it.
...
Forum: C++ 2 Days Ago
Replies: 6
Views: 192
Posted By vmanes
Look at the order you are using the search functions.
You call the function, looking for a fixed number.
You then ask the user to enter a search value.
You then test the result of your search, for...
Forum: C++ 3 Days Ago
Replies: 1
Views: 126
Posted By vmanes
How about:

while( INSTREAM.getline(line,500) )
{
OUTSTREAM << counter << line;
counter++;
}


You can search on DaniWeb why the eof( ) usage is not advised.
Forum: C++ 3 Days Ago
Replies: 10
Views: 313
Posted By vmanes
I get no errors on that line, but several other compiler errors and warnings do come up (Visual C++ 2008)

Have you in fact posted the latest version of your code that is giving you problems? Have...
Forum: C++ 9 Days Ago
Replies: 2
Views: 145
Posted By vmanes
I'm surprised you get even that. Firstly, if you're getting warnings from your compiler, pay attention to them and fix the problems.

#1 - it's int main( ) , not just main( )

#2 - quotatot is...
Forum: C++ 17 Days Ago
Replies: 17
Solved: Void Functions
Views: 451
Posted By vmanes
You should check where the program crashes, and read the error message(s).

Check your arguments closely - what's being used here, and what is being used without having a value assigned?
...
Forum: C++ 17 Days Ago
Replies: 3
Views: 161
Posted By vmanes
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". mpg = miles / gallons better...
Forum: C++ 17 Days Ago
Replies: 2
Solved: help please
Views: 185
Posted By vmanes
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?
Forum: C++ 19 Days Ago
Replies: 2
Views: 153
Posted By vmanes
results[0]= x * sin (x);
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 results[i]= x[i] * sin (x[i]);?
Forum: C++ 19 Days Ago
Replies: 2
Views: 129
Posted By vmanes
Actually, it does make a difference. The declaration outside of main( ) is globally visible and modifiable. This is generally to be avoided, especially in beginning programs, as it may cause the...
Forum: C++ 19 Days Ago
Replies: 1
Views: 178
Posted By vmanes
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......
Forum: C++ 19 Days Ago
Replies: 10
Views: 319
Posted By vmanes
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...
Forum: C++ 28 Days Ago
Replies: 4
Views: 254
Posted By vmanes
Do you have a pencil and a piece of paper handy?

This is C++.
Forum: C++ 30 Days Ago
Replies: 4
Views: 264
Posted By vmanes
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.
...
Forum: C++ 31 Days Ago
Replies: 3
Views: 425
Posted By vmanes
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

char arr[6];
//open your...
Forum: C++ 31 Days Ago
Replies: 4
Views: 254
Posted By vmanes
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.)
Forum: C++ 33 Days Ago
Replies: 5
Views: 251
Posted By vmanes
Hmm, bet you made the file in notepad and named it "test.txt", and Vista added the other .txt. Or VS might have done the same thing.

That's why I like to set my systems to display the file...
Forum: C++ 33 Days Ago
Replies: 5
Views: 251
Posted By vmanes
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?
Forum: C++ 33 Days Ago
Replies: 1
Views: 187
Posted By vmanes
Long time ago I used this article (http://msdn.microsoft.com/en-us/magazine/dvdarchive/cc301454.aspx)as a reference to do such.

Unfortunately, it seems the supporting code is not available at...
Forum: C++ 34 Days Ago
Replies: 1
Views: 260
Posted By vmanes
Here's your code, translated in to C++.

#include <fstream>
#include <iostream>
using namespace std;


void READFile(char* filename)
{
int num;
Forum: C++ 34 Days Ago
Replies: 3
Views: 383
Posted By vmanes
And your question is?
Forum: C++ 34 Days Ago
Replies: 4
Views: 206
Posted By vmanes
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.
Forum: C++ 34 Days Ago
Replies: 4
Views: 375
Posted By vmanes
RTE, I think you're reading too much into this. The airline reservation/seating problem is a common assignment in beginning programming course, as evidenced by the many times it's come up here.
Forum: C++ 34 Days Ago
Replies: 4
Views: 375
Posted By vmanes
Read the full assignment. It should all be there.
Forum: C++ 34 Days Ago
Replies: 2
Views: 175
Posted By vmanes
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...
Forum: C++ 34 Days Ago
Replies: 4
Views: 212
Posted By vmanes
Yes, you could use a loop to print only up to 22 characters. Be sure to first test the length of the actual string content, and limit your loop to 22 or the string length, whichever is less.
Forum: C++ Oct 17th, 2009
Replies: 3
Views: 174
Posted By vmanes
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 this in as either a...
Forum: C++ Oct 17th, 2009
Replies: 4
Views: 212
Posted By vmanes
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...
Forum: C++ Oct 16th, 2009
Replies: 1
Views: 172
Posted By vmanes
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...
Forum: C++ Oct 16th, 2009
Replies: 3
Views: 357
Posted By vmanes
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

your code goes here


Big problem with your second...
Forum: C++ Oct 15th, 2009
Replies: 5
Views: 501
Posted By vmanes
For your array, if the problem is given as a set size, just declare a local array, as you show int plate[10][10]; for example.

If no specific info is given for initial state of interior nodes,...
Forum: C++ Oct 14th, 2009
Replies: 5
Views: 216
Posted By vmanes
YES, that was a typo
Should read
for( c = 0; c < 5; c++ )

(walks away with embarrassed look)
Forum: C++ Oct 14th, 2009
Replies: 5
Views: 501
Posted By vmanes
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,...
Forum: C++ Oct 14th, 2009
Replies: 5
Views: 216
Posted By vmanes
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...
Forum: C++ Oct 13th, 2009
Replies: 2
Views: 207
Posted By vmanes
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...
Forum: C++ Oct 13th, 2009
Replies: 3
Views: 252
Posted By vmanes
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...
Forum: C++ Oct 12th, 2009
Replies: 3
Views: 368
Posted By vmanes
Sure you could modify during runtime. And make allowance to store the parity bit(s) as well.

Say you want to store a byte, plus a parity bit. Allocate an array of 9 char's (unsigned, if you want,...
Showing results 1 to 40 of 1000

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC