GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — cpp-code-snippets/complex.cpp at master · keineahnung2345/cpp-code-snippets

Expand file tree

/

complex.cpp

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
15 lines (13 loc) · 431 Bytes
/

complex.cpp

Copy path

File metadata and controls

15 lines (13 loc) · 431 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// complex::real example
#include <iostream> // std::cout
#include <complex> // std::complex
int main (){
std::complex<double> org(0.0,0.0), p1(3.0, 4.0);
std::cout << "Real part: " << p1.real() << ", imaginary part: " << p1.imag() << std::endl;
std::cout << "Distance to original point: " << std::abs(p1-org) << std::endl;
return 0;
}
/*
Real part: 3, imaginary part: 4
Distance to original point: 5
*/
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.