Search
 
SCRIPT & CODE EXAMPLE
 

CPP

trig in c++

// C++ code to demonstrate the example of 
// trigonometric functions

#include <iostream>
#include <cmath>
using namespace std;

// main() section
int main()
{
    float x;
    float y;
    
    x = 0.25;
    cout<<"cos("<<x<<") : "<<cos (x)<<endl;
    cout<<"sin("<<x<<") : "<<sin (x)<<endl;
    cout<<"tan("<<x<<") : "<<tan (x)<<endl;
    cout<<"acos("<<x<<"): "<<acos(x)<<endl;
    cout<<"asin("<<x<<"): "<<asin(x)<<endl;
    cout<<"atan("<<x<<"): "<<atan(x)<<endl;
    y = 1.0;
    cout<<"atan2("<<y<<","<<x<<"): "<<atan2(y,x)<<endl;    
    
    return 0;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to make sound in c++ 
Cpp :: swap first and last character of string in c++ 
Cpp :: c++ inline if 
Cpp :: pre increment vs post increment c++ 
Cpp :: ceil value in c++ using formula 
Cpp :: c++ environment setup 
Cpp :: a function to create double quotes for alphabet in c++ 
Cpp :: create a bitset of 1024 bits, 
C :: boilerplate c 
C :: generate n-bit gray code in c 
C :: how to store a user input with spaces in c 
C :: factorial in c 
C :: how to make a hello world program in c 
C :: C overwrite last line 
C :: c code to python code converter online 
C :: find power of a number in c 
C :: C program to count number of digits in a number 
C :: #![feature]` may not be used on the // stable release channel 
C :: strcasecmp in c 
C :: arduino millis() 
C :: recursion to convert decimal to binary 
C :: typedef pointer 
C :: how to modulo in c without % 
C :: c int 
C :: c get current month, year, day 
C :: enum in c 
C :: write a c program to find size of variable 
C :: check if pid exists c 
C :: c long to string 
C :: c program for swapping of two numbers 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =