473,473 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

can someone tell what is this question want actually?

9 New Member
The following series summation is an approximation for computing the natural logarithm of a floatingpoint
value x:

logx=[(x-1)]–[[(x-1)^2]/2]+[[(x-1)^3]/3]–[[(x-1)^4]/4]+….+(-1)n+1(x-1)^n/n

Where 2 >= x > 0 and n is a positive integer.
Design and implement an interactive program that does the following:
1. Prompts the user to enter a floating-point value for x and reads it.
2. Ensures that x is in the proper range; if not, re prompts the user to enter another value.
Oct 6 '09 #1
5 1542
zewl
9 New Member
i need to know how to start.
Oct 6 '09 #2
whodgson
542 Contributor
1.
It wants you to write a "prompt" like "Enter a floating point number" and it also wants the "cin>> ? " code to allow the user to input the floating point number.
2.
It wants code included which will reject a value for x which does not conform with the pre-invariant of 2>x>0. (x must be less than 2 and greater than 0)
i.e if as a result of cin>>x; x evaluated to 2.36 a message would be printed such as "x too big" and return the user to the loop start to enter a valid input which respected the pre-invariant..
Oct 6 '09 #3
Banfa
9,065 Recognized Expert Moderator Expert
Stangely, as you can get by implication from whodgsons reply it gives the details of a power series but never asks you to put it into code. It almost looks like you have 1/2 the question.
Oct 6 '09 #4
maiyappan
4 New Member
read d value for x,n.check wheather if(x>0&&x<=2) then if it true then claculate
d logx in a for loop like given below
if(x>0&&x<=2) {
mul=1;logx=0;
for(i=1;i<=n;i++)
{
mul*=(x-1);
logx+=mul/(float)i;
}}
Oct 6 '09 #5
zewl
9 New Member
owh ic.. i'll try to do it.. any problem later i will post..
thx...
>.<
Oct 6 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: John Lin | last post by:
Howdy, I want to know how to tell if a forked process is done. Actually, my real question is that I want to run a shell script inside of a python script, and after the shell script has...
21
by: MLH | last post by:
A97 procedure to open http://www.arch.com/message/ enter an 800 number, press "Continue", enter a text msg string from a memo field and press "Send" This is a calendaring and appointment A97...
20
by: nicolas.riesch | last post by:
I try to understand strict aliasing rules that are in the C Standard. As gcc applies these rules by default, I just want to be sure to understand fully this issue. For questions (1), (2) and...
29
by: Roy Gourgi | last post by:
Hi, I am new to C#. I have the same time scheduling program written in C++ and it is 5 times faster than my version in C#. Why is it so slow as I thought that C# was only a little slower than...
18
by: Chris Botha | last post by:
Hi, I've tried the SQL Server newsgroups and it seems nobody did it there, I got no replies, or those that did it don't want to tell. I have VS2005 Beta 2 installed with VS2003 and everything...
3
by: Amy | last post by:
Hi, I have 6 If Then Else statements I was supposed to write. I did so but I know that they have to be wrong because they all look the same. Could someone take a look at them and point me in the...
5
by: Simon Verona | last post by:
I have an inherited datagrid which has a "double-click" even which returns the row that has been clicked on - this can be consumed by the form (etc) that hosts the control to open another window...
7
by: Robert Blackwell | last post by:
Hey, I have a question for you web devs out there. How much of a hassle is it to take over where another programmer left off. I have a commerce site that was designed to my specs and I approached...
6
by: Dildo Boy | last post by:
I am trying to write a program which asks the user to enter a number in the interval , the program then gives the natural logarithm of that number, using the series for log(x+1)... Here is what...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.