Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
PriorQ
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
//g++ 7.4.0 //////////////////////////////////////////////////////////////////////////// //PriorQ //this code is created by Rezaul Hoque on July 07,2022; //contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; ///////////////////////////////////////////////////////////////////////////// #include <iostream> #include <queue> #include <string> class DePQ{ std::string city; public: DePQ(){} DePQ(std::string s){city =s; } DePQ(const DePQ& c){ city=c.city; } ~DePQ(){} std::string getC(){return city;} }; int main() { std::priority_queue<std::string> p; DePQ* a; a=new DePQ[3]; a[0]={"Sparta"}; a[1]={"Athens"}; a[2]={"Rome"}; const auto z={a[0].getC(),a[1].getC(),a[2].getC()}; for(auto n: z) p.push(n); while (p.empty()==false) { std::cout<<p.top()<<"\n"; p.pop(); } return 0; }
g++
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 2.31 sec, absolute running time: 0.21 sec, cpu time: 0 sec, memory peak: 6 Mb, absolute service time: 2,61 sec
edit mode
|
history
|
discussion
Sparta Rome Athens Athens Rome Sparta