User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
DaniWeb is a massive community of 374,510 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,860 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Showing results 1 to 40 of 60
Search took 0.01 seconds.
Posts Made By: murschech
Forum: C++ Jan 15th, 2007
Replies: 3
Views: 1,312
Posted By murschech
Re: Setprecision help please

Good for your compiler! The stored value of a floating point number has a limited precision, probably 50 or 60 bits. This is equivalent to a certain number of decimal digits, say about 15. If the...
Forum: C++ Jan 7th, 2007
Replies: 17
Views: 1,631
Posted By murschech
Re: It's cinfull!

So what's a poor programmer to do? Since it's apparently not possinble to know when this troubelsome newline char will appear would you recommend that cin.ignore() be used before any call to cin >>?...
Forum: C++ Jan 6th, 2007
Replies: 17
Views: 1,631
Posted By murschech
Re: It's cinfull!

Thanks for the explanation. I still have a question. Now I can't see why the
little program below works.

#include <iostream>
using namespace std;

main()
{ int x,y;
cout << "Enter x: ";
...
Forum: C++ Jan 1st, 2007
Replies: 17
Views: 1,631
Posted By murschech
It's cinfull!

In using "cin" for getting input I have about a 99% success rate. In the remaining
1% of cases the program does not pause for input. What causes this and how does one fix it?

In ancient times when...
Forum: C++ Feb 10th, 2006
Replies: 2
Views: 1,112
Posted By murschech
Forbidden function names in Dev_C++?

Calling all Dev_C++ users,

Here's a mystery! The following little program, which determines whether one integer is a divisor of another or not, compiles and runs fine using Borland's...
Forum: C++ Sep 20th, 2005
Replies: 10
Views: 1,781
Posted By murschech
Re: Trying to create basic calculator but...Some help please

I ran it and it works ok. In response to the prompt you enter a, then a space, then b, then a carriage return. You can also respond a, carriage return, b, carriage return. Your comments indicate that...
Forum: C++ Jul 28th, 2005
Replies: 1
Views: 3,226
Posted By murschech
external variables in a multifile program

I have a question on external variables in a multifile program.
Quoting from K&R (first addition, page 72)

"By default, external variables are also "global", so that all references to such a...
Forum: C++ Jul 6th, 2005
Replies: 2
Views: 5,429
Posted By murschech
Re: need a little help with standard deviation

You seem to have computed the average correctly. The most efficient way to compute the standard deviation is to use the formula

st. dev. = sqrt( (sum of squares -ct*square of av)/(ct - 1) )

so...
Forum: C++ Jul 2nd, 2005
Replies: 10
Views: 8,613
Posted By murschech
Re: help with Greatest common divisor

I think I've already answered this but I'll do it in more detail.

x is divisible by i if the remainder when x is divided by i is 0, that is, x is divisible by i if and only if x%i == 0. Likewise, y...
Forum: C++ Jul 1st, 2005
Replies: 10
Views: 8,613
Posted By murschech
Re: help with Greatest common divisor

The original posting (minah1984) seems to be using the definition of gcd to find the gcd. That's not a bad idea. The one thing missing is that he/she doesn't know how to tell whether i is a common...
Forum: C++ Jul 1st, 2005
Replies: 20
Views: 12,783
Posted By murschech
Re: Program that determines if a number is prime

Your program doesn't make use of the efficiencies I mentioned. For one thing, you test possible factors up to valuex/2 but you only have to go up to sqrt(valuex), which is much smaller. (For example,...
Forum: C++ Jun 30th, 2005
Replies: 20
Views: 12,783
Posted By murschech
Re: Program that determines if a number is prime

Someone commented that to see if n is a prime you only have to check possible divisors < sqrt(n). In addition, you can decrease the computing time a lot by testing the divisor 2 , then 3, 5, 7...,...
Forum: C++ Jun 30th, 2005
Replies: 3
Views: 2,441
Posted By murschech
Re: Pointer to function as an argument

Thanks a lot! Your program works fine and it tells me just what I need to know. I thought that I'd have to say in the declaration of F that *f is a function of two variables and I didn't know how to...
Forum: C++ Jun 29th, 2005
Replies: 3
Views: 2,441
Posted By murschech
Pointer to function as an argument

Attached is a tiny program in which the function F has as an argument the function pointer double (*f) (double). F returns the sum f(1)+f(2)+f(3)+f(4).
(Naturally, I have a much more interesting...
Forum: C++ May 30th, 2005
Replies: 2
Views: 1,423
Posted By murschech
Re: help me in primmitive root

There are a number of problems with your program. The main one is that, while it prints out a lot of stuff that you don't need to see, it never performs the tests it's supposed to. Where do you test...
Forum: Computer Science and Software Design Apr 27th, 2005
Replies: 2
Views: 3,686
Posted By murschech
Re: PseudoCode Help For Newbie

I think that your "pseudocode" suffers from imprecision. If you tried to turn it into code in some language that you know (C, Pascal, Basic, or whatever) you'd see the problem. You could also check...
Forum: C++ Apr 20th, 2005
Replies: 2
Views: 1,912
Posted By murschech
Re: reading records from a file

Might it be that "employees" is ambiguous? It's both the name of the an array of integers and it's also a type that you've defined. (struct employees).
Forum: C Apr 4th, 2005
Replies: 3
Views: 4,583
Posted By murschech
Re: Combinations(N choose R) ?

One problem is that you'r not correctly initializing the variables in calcCNR. The last variable is where the result appears. When you call the function this variable has no significant value. I'm...
Forum: C Mar 23rd, 2005
Replies: 1
Views: 1,731
Posted By murschech
Re: Input for a solution to matrix problem

Here's an idea for how to partially solve the problem. I'm assuming that this is not for a first course in programming or CS. Specifically, I'm assuming you've studied trees (not just binary trees)....
Forum: C++ Mar 20th, 2005
Replies: 11
Views: 11,351
Posted By murschech
Re: Best free C/C++ compiler for a newbie?

I've been following this thread and I also downloaded the Bloodshed compiler. Can you tell me where that online tutorial is?
Forum: Computer Science and Software Design Mar 2nd, 2005
Replies: 1
Views: 3,175
Posted By murschech
Re: Floating Point Representation

I don't know what "unnormalized" means, but here's how to write it as a normalized floating pt. number: Since the smallest pwer of 2 bigger than the given number is 32, write it as
21.426304 =...
Forum: Computer Science and Software Design Mar 1st, 2005
Replies: 2
Views: 2,858
Posted By murschech
Re: I hit a brick wall-- time complexity problem

This looks like a variation on binary search. It divides the range a1..an into three equal pieces (roughly) and uses two comparisons to determine in which third x lies. The worst case occurs (I...
Forum: C++ Feb 23rd, 2005
Replies: 3
Views: 1,671
Posted By murschech
Re: Developing A Class

First, a tangential comment. Your function "addem" has a problem. You want the answers to appear in the variables na and da, so you'r asking the function to change the value of variables on the...
Forum: C++ Feb 22nd, 2005
Replies: 1
Views: 1,526
Posted By murschech
Re: Need help with a program that calc Tax

Here are a few observations.
1: Your class has only public members. You're probably supposed to make the variable members private. (This isn't required by C++, but what's the point of classes if you...
Forum: C++ Feb 17th, 2005
Replies: 11
Views: 2,327
Posted By murschech
Re: need help w/ typedef

I have 2 questios.

1: what do the error messages say?
2: It looks to me like the whole program is turned into a comment! If not, whats the /* doing?
Forum: C++ Feb 17th, 2005
Replies: 10
Views: 4,559
Posted By murschech
Re: simple c++ program (any help would be greatly appreciated)

Afew postings back I sent as an attachment a file called watch, which is a bare-boned program which would get you started. It doesn't do military time and it doesn't do the time difference. Have you...
Forum: C++ Feb 16th, 2005
Replies: 10
Views: 4,559
Posted By murschech
Re: simple c++ program (any help would be greatly appreciated)

I think I see a couple of problems. For one thing, you can't have time difference as a member function. The reason is that the time difference is not determined by the data in the object. That is,...
Forum: C++ Feb 16th, 2005
Replies: 10
Views: 4,559
Posted By murschech
Re: simple c++ program (any help would be greatly appreciated)

Time after 12:00 in seconds = seconds + 60*minutes + 3600*hours. (but 12 o'clock becomes 0). For example, at 2:23:50 PM the time that has elapsed since noon is 50+23*60+2*60*60 seconds.

When...
Forum: C++ Feb 16th, 2005
Replies: 10
Views: 4,559
Posted By murschech
Re: simple c++ program (any help would be greatly appreciated)

Here's my contribution, on the attached file. I hope iit's of some use to you
Forum: C++ Feb 15th, 2005
Replies: 5
Views: 2,639
Posted By murschech
Re: hop over decimal and straight to business

Your example of 6Z's in base 36 ought to work if you interpret it as an unsigned long integer. The value of this number is 36^6 -1, which is about 2 billion 176 million. which is well within the...
Forum: C Feb 14th, 2005
Replies: 6
Views: 10,848
Posted By murschech
Re: Transpose a matrix

Sorry. I didn't read your code carfully enough before I replied.
Forum: C Feb 14th, 2005
Replies: 6
Views: 10,848
Posted By murschech
Re: Transpose a matrix

Your program won't work. The reason is that when you write matrix[i][j] = matrix[j][i] you've lost the contents of matrix[i][j] forever and you can't get it back to put in position [[j][i]. This will...
Forum: C++ Feb 14th, 2005
Replies: 5
Views: 2,639
Posted By murschech
Re: hop over decimal and straight to business

In order to change the basis you have to do arithmetic. For instance, if you're talking about integers, then the rightmost digit to base N is gotten by dividing the number by N and taking the...
Forum: C++ Feb 8th, 2005
Replies: 2
Views: 2,022
Posted By murschech
Re: Friend classes?

Thank you.
Forum: C++ Feb 8th, 2005
Replies: 2
Views: 2,022
Posted By murschech
Friend classes?

A rather old C++ book I have says that one class may be declared a friend class of a second, and then the first class can access the private data of the second. I tried this example
[code]
#include...
Forum: C Feb 8th, 2005
Replies: 5
Views: 2,317
Posted By murschech
Re: needed recursion help

I'm not sure I know what you mean by having it "all the way to prime number checking". I'll guess that you mean that you know how to check whether the given number is a prime or not. If you find that...
Forum: C++ Feb 7th, 2005
Replies: 2
Views: 2,488
Posted By murschech
Re: c++ classes

For starters, you'll need 2 constructors. One will be something like

rational(int m, int n)
{ num = m;
den = n; //You really should check for n == 0
}
[\code]
and the other (the default) would...
Forum: C++ Feb 6th, 2005
Replies: 2
Views: 3,532
Posted By murschech
Re: calling a decimal function

You don't need a private function.. Here's a simple fraction class. I hope this works. The last time I tried attaching a file I didn't succeed.)
Forum: C++ Feb 6th, 2005
Replies: 2
Views: 3,532
Posted By murschech
Re: calling a decimal function

You don't need a private function here. Also I don't think it's a good idea to make the numerator and denominator doubles. For one thing, they may not print out properly, i.e., you may have a...
Forum: C++ Jan 31st, 2005
Replies: 2
Views: 6,607
Posted By murschech
Re: a simple way to print a binary representation of a floating point number?

Here's a program that writes a float or double in the form 2^exp * mantissa, with the mantissa expanded in binary. IEEE specs might call for an offset of the exponent.


#include...
Showing results 1 to 40 of 60

 
All times are GMT -4. The time now is 2:27 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC