Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
compile c++ gcc online
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//My type nicro #include <iostream> using namespace std; template<class T>class nicro{ public: nicro(){} nicro(const nicro& n): val(n.val){} nicro(const T& t) : val(t){} ~nicro(){} nicro& operator =(const nicro& other){ val = other.val; return *this; } int operator <(const nicro& other)const{ return val < other.val; } int operator ==(const nicro& other)const{ return val == other.val; } friend ostream& operator <<(ostream& out, const nicro& n){ out << n.val; return out; } private: T val; }; typedef nicro<double>dNicro; typedef nicro<int>iNicro; int main() { dNicro dn1; dNicro dn2(40.25); dNicro dn3(dn2); dNicro dn4(255); dNicro dn5(2*8); iNicro in1(4095); iNicro in2; iNicro in3(in1); iNicro in4(65); dn1 = dn4; cout << "\ndn2 = " << dn2; cout << "\ndn3 = " << dn3; cout << "\ndn1 = " << dn1; cout << "\ndn4 = " << dn4; cout << "\ndn5 = " << dn5; cout << "\n"; cout << "\nin1 = " << in1; cout << "\nin3 = " << in3; in2 = in4; cout << "\nin4 = " << in4; cout << "\nin2 = " << in2; return 0; }
g++
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.42 sec, absolute running time: 0.06 sec, cpu time: 0.01 sec, memory peak: 3 Mb, absolute service time: 0.49 sec
latest
|
history
dn2 = 40.25 dn3 = 40.25 dn1 = 255 dn4 = 255 dn5 = 16 in1 = 4095 in3 = 4095 in4 = 65 in2 = 65