Ok so my output is supposed to be a table of tangent values of some angles. say for example, your minimum is 29.68 and your max is 30.23, it should print values starting from 29.7 to 30.2, but when i run it i get an extra line that says 30.3, which has no output in it. I want this line gone, can anyone fine the error?
{
double pi, value, inc, converted;
float mina, maxa;
int counter, count;
pi=3.14159;
counter=0;
inc=0.01;
count=10;
cout<<"This program will generate tables of tangents";
cout<<"\nEntering numbers that are greater than/equal to 90, less than/equal to 0, or in the wrong order will terminate the program.";
cout<<"\n\n ~~ ~~ ~~ ~~ ~~ ~~ ";
for (;;)
{
cout<<"\n\nPlease enter the minimum and maximum angle values: ";
cin>>mina>>maxa;
value=mina;
if (!cin)
cout<<"Bad >Update:
the question cuts off 3 times where it shows "..."
here are the full lines
cout<<showpoint<<setpresicion(3)
<<value<<" | ";
cout<<setprecision(4)
<<tan(converted)<<" ";
cout<<showpoint<<setprecision(3)
<<value<<" | ";
Copyright © 2024 Q2A.ES - All rights reserved.
Answers & Comments
Verified answer
It's hard to read the code without indenting, but when
(counter==count)
Are you done at that point? If so, try adding:
break;
Optionally, can you change:
count=10;
to:
count=9;
And finally, don't you have a debugger where you can set a breakpoint and see why you're going into this loop when you think you should be done?
Good luck!