Programming C++ Project

  • Thread starter hytuoc
  • Start date
  • #1
26
0
I am working on a project, I am attaching my code and the Solutions...im not sure wat is wrong w/ the code, but i couldnt get it to ask for "Inputting a value for a" at all...i was able to get it to input theta1 and theta2 though. Plz help me out ASAP...I want to attach my assignment pages along w/ this but the file is too big...
Thanks so much
 

Attachments

  • C++.txt
    4.1 KB · Views: 347
  • sample calc.doc
    36 KB · Views: 130

Answers and Replies

  • #2
551
1
Surely that while loop isn't going to run, since a is neither less than 0.25 or greater than 1 initially? I've only done a little bit of C++, so I can't remember if it has a do-while loop (though I expect it does), where you can get the loop to run at least once. It sounds like you should use that instead of while.
 
  • #3
180
0
Ahh! Don't use the old *.h including files. Use the new ISO headfiles. The old name, whitout the ending ".h".

Actually I don't have enough time to understand your algorithm...

But that option function looks quite nasty to me. Just pass the chosen number by value istead is my recommdation...

Personally, I don't like do-while loops, and Code Complete advise you to not use them, but in this case the use of them is justified...
 
  • #4
551
1
Also, aren't you technically meant to declare main() as int in C++? I've heard some compilers don't like when you use void.
 
  • #5
26
0
Nylex said:
Surely that while loop isn't going to run, since a is neither less than 0.25 or greater than 1 initially? I've only done a little bit of C++, so I can't remember if it has a do-while loop (though I expect it does), where you can get the loop to run at least once. It sounds like you should use that instead of while.
inputing a, I did the same thing to ask for input for theta1 and theta2...how come it work fine for those put not for "a"??
 
  • #6
26
0
Got it to ask for inputing the value for a...now I have another probelm...the approximate length isnt working right when i compare my sol'n w/ the samplecalc. Im attaching my updated code along w/ this message
I have to write a program that compute the arc length : "A segment of the curve can b divided into intervals and a chord to the curve draqn in each interval. The approximate length of the segment is obtained by adding up the lenghts of the chords. The accuracy of the result is a function of the number of intervals used. Increasing the number of the chords increases the accuracy, but only up to a point. The computation is to be terminated when the use of a larger number of intervals produces a negligible change in the result."
and there is one part I that i have to do...but not sure how:
Call function approx to compute aplen, the approximate value of the length. Use n=4 intervals for the first approximation. Repeat the computaion up to 10 times, doubling the value of n each time, as long as successive length values are increasing, and differences between successive values are decreasing and are greater than .01 percent(%) of the approximate value.
 

Attachments

  • C++.txt
    4.1 KB · Views: 297
  • #7
26
0
someone plz help me out w/ this ASAP...thanks much
 

Related Threads on Programming C++ Project

  • Last Post
Replies
7
Views
3K
  • Last Post
Replies
4
Views
2K
  • Last Post
2
Replies
41
Views
6K
  • Last Post
Replies
8
Views
4K
  • Last Post
Replies
2
Views
1K
  • Last Post
Replies
9
Views
16K
Replies
8
Views
1K
  • Last Post
Replies
15
Views
2K
  • Last Post
2
Replies
29
Views
18K
Top