It is a more of a logic problem then programming and I am having a hard time dealing with it last nigh
"Angles are often measured in degrees (), minutes (‘), and seconds (“). There are 360 degrees in a circle, 60 minutes in one degree, and 60 seconds in one minute. Write a program that reads two angles expressed in degrees, minutes, and seconds from a file, and then calculates and prints their sum. The number of minutes in your answer should be no greater than 59, and the number of seconds in your answer should be no greater than 59. Why do you suppose that’s the case?
this is what in the input file:
3358 14 55
5 24 55
my codes so far
#include <iostream> // for the cout D M S
#include<fstream> // needed for openinga file
#include<string>
using namespace std;
main()
{
ifstream infile ;
double D1,M1,S1,D2,S2,M2 ;
int t,D,S,M;
One word, the abscence of indentation of code. Thread over.
Name:
Anonymous2007-02-10 16:45
I would help you but i don't get it :S
What are you supposed to do with those numbers:
3358 14 55
5 24 55
And finally what the output of the program should be?
Name:
Anonymous2007-02-10 16:59
Ok sorry I didn't copy paste the hint and ouput
"Hint: This problem can be messy, unless you tackle it in a methodical way. A suggested approach is to first convert both angles to seconds, before you add them. After you do the addition, your result will be in seconds. You can then convert the resulting seconds to degrees, minutes, and seconds, and display your answer in that form.
Since it may be difficult to print the special character representing degrees, use the characters d, m, and s to represent degrees, minutes, and seconds, respectively. For example, 15034’21” can be represented as 150d 34m 21s. Your answer should be presented in the following format:
7d 14m 55s + 5d 24m 55s = 12d 39m 50s
You may obtain a sample input file from Blackboard. Test your program with various pairs of angles (i.e., multiple input files)."
the input file is a .txt file with the 6 values in it. I am not having a problem with oppining the file it is just the part where I have to convert all seconds to degrees and minutes. I rewrited the cpp so you wouldn't need to make a .txt file
#include <iostream> // for the cout D M S
#include<string>
using namespace std;
main()
{
double D1 =3358,M1=14,S1=55,D2=5,S2=24,M2=55 ;
int t,D,S,M;
Don't forget that 360 degrees is a complete loop, so remove anything in excess of it.
Name:
Anonymous2007-02-10 17:18
it was diff = abs(ang1 + ang2) Thank you that will do it
Name:
Anonymous2007-02-10 20:21
>>6: Don't forget that 360 degrees is a complete loop, so remove anything in excess of it.
This means that you do a check for degrees % 360.
This should result in a sort of feedback loop where you have to re-check your total number of minutes and seconds, probably.
Name:
Anonymous2007-02-10 23:24
Fortunately not. Just do the modulo on degrees alone once you've finished conversions.
finaldeg = finaldeg % 360;
Name:
Anonymous2007-02-10 23:32
>>7
If you're finding the sum, not the difference, you don't need abs().
Name:
Anonymous2007-02-12 3:51
>>9
If you don't mind because the library does it itself or you'll do further processing to it, don't; you can spare your processor of the IDIV.
CFLAGS JUST KICKED IN, YO!
Name:
Anonymous2009-01-14 14:19
Turing
Name:
Anonymous2009-03-06 13:45
The string example pushed.
Name:
Anonymous2012-03-23 23:38
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy
Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
Name:
Anonymous2013-09-01 13:23
The characters initially were too gimmicky to feel like actual characters, though they're starting to flesh out a little bit now.
Name:
Anonymous2013-09-01 14:54
Anyone got the chart for latest Nogizaka's handshake event?