http://cpptutorials.freeforums.org/c-c-standard-library-functions-t84.html
| Welcome | |
|---|---|
|
Welcome to the forums of AntiRTFM's Absolute N00b Spoonfeed C++ Tutorials! You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. Registration is fast, simple, and absolutely free, so please, <a href="/profile.php?mode=register">join our community today</a>! |
|
#include <cmath>
int main ()
{
cout << sqrt (25) << "the square root of 25 is 5";
}#include <cmath>
#include <iostream>
using namespace std;
int main ()
{
float question = 25;
float answer = sqrt ( question)
cout << answer << "the square root of 25 is 5";
}#include <cmath>
double sqrt( double num );
Doctor Salt wrote:So you couldn't just do?
- Code: Select all
#include <cmath>
int main ()
{
cout << sqrt (25) << "the square root of 25 is 5";
}
#define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
using namespace std;
float DegreesToRadians( const float fAngleInDegrees )
{
return (fAngleInDegrees * (float)M_PI) / 180.0f;
}
int main()
{
for ( float fAngle = 0.0f; fAngle < 360; fAngle += 1.0f )
{
cout << "Sin(" << fAngle << ") = " << sinf(DegreesToRadians(fAngle)) << endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int number;
cout << "Insert a number: ";
cin >> number;
(number % 2 == 0) ? cout << endl << "The number is Even !\n\n" : cout << endl << "The number is Odd !\n\n";
system("pause");
}#include <iostream>
using namespace std;
int main(void)
{
//declare variable
int input;
//Asks user to input variable
cout << "Please enter a whole number: ";
cin>> input;
while(!cin.good())
{
cout << "Please enter a valid number! ";
cin >> input;
return 0;
}
while(cin.good())
{
if ((input%2) == 0)
{
cout << "\nThis number is even!\n";
}
else
cout << "\nThis number is odd!\n";
return 0;
}
}#include <iostream>
using namespace std;
int main(){
int number;
cout << "Enter your number: ";
cin >> number;
cout << endl;
if(number%2 == 0){
cout << "Even" << endl;
}
else if(number%2 == 1){
cout << "Odd" << endl;
}
system("pause");
return 0;
}
Users browsing this forum: No registered users and 0 guests