www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/03/17:51:35

From: "Stewart" <jstewart1 AT ns DOT sympatico DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: trig function?? loopings
Lines: 40
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <Fqeo6.142$nj5.49880@sapphire.mtt.net>
Date: Sat, 03 Mar 2001 22:41:41 GMT
NNTP-Posting-Host: 142.177.226.216
X-Complaints-To: abuse AT mpoweredpc DOT net
X-Trace: sapphire.mtt.net 983659301 142.177.226.216 (Sat, 03 Mar 2001 18:41:41 AST)
NNTP-Posting-Date: Sat, 03 Mar 2001 18:41:41 AST
Organization: MPowered-Subscriber
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I am trying to write a program that prompts the user for a value in degrees
and outputs the sine, cosine and tangent of the value entered. This is what
I did:

#include <iostream.h>
#include <math.h>

void main(void)
{


double degrees, cosine;


cout << "Enter a number of degrees: ";

cin >> degrees;


cosine = cos(degrees*180/M_PI);


cout << "Cosine: " << cosine << endl;

cout << "Sine: " << sin(degrees*180/M_PI) << endl;

cout << "Tangent:" << tan(degrees*180/M_PI) << endl;
}

I want to include a sentinel loop to prompt the user repeatedly until the
user decides to stop. I need some help to do this. Will anyone help me?









- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019