TGViewer
C++ - Reddit C++ - Reddit @r_cpp · 228 subscribers
Post #24075 15
Surprisingly, the above c++ code work!

i used this code and it worked in my compiler:

\#include <iostream>

\#include <string>

using namespace std;



class 🐶 {

private:

double 🍰;

double 📏;

double 📐;



public:

🐶(double 🍰_, double 📏_, double 📐_) {

🍰 = 🍰_;

📏 = 📏_;

📐 = 📐_;

}



friend double 🧮(🐶 📦);

};



class 🧊 {

private:

double 📏;

double 📐;

double 📦;



public:

🧊(double 📏_, double 📐_, double 📦_) {

📏 = 📏_;

📐 = 📐_;

📦 = 📦_;

}



friend double 📊(🧊 💠);

};



double 🧮(🐶 📦) {

return 📦.🍰 * 📦.📏 * 📦.📐;

}



double 📊(🧊 💠) {

return 💠.📏 * 💠.📐 * 💠.📦;

}



void 🆚(🐶 📦, 🧊 💠) {

double 🔲 = 🧮(📦);

double 🔹 = 📊(💠);



if (🔲 > 🔹) {

cout << "📦 has a larger volume: " << 🔲 << endl;

} else if (🔹 > 🔲) {

cout << "💠 has a larger volume: " << 🔹 << endl;

} else {

cout << "Both have the same volume: " << 🔲 << endl;

}

}



int main() {

🐶 📦(2.5, 4.5, 5.3);

🧊 💠(3.8, 5.3, 6.8);



🆚(📦, 💠);



return 0;

}

https://redd.it/1o9egmz
@r_cpp
Reddit From the cpp community on Reddit Explore this post and more from the cpp community
More from @r_cpp
  1. Oct 14, 2026I tested whether a coding agent would use C++23 ranges without being told Blog post: https…
  2. Oct 14, 2026C++ futures part 1: The mental model https://devblogs.microsoft.com/oldnewthing/20261012-0…
  3. Oct 14, 2026C++ futures part 2: The mental model for std::promise, std::packaged_task https://devblogs…
  4. Oct 12, 2026[Release] slick-logger v2.2.0 — Lock-free asynchronous C++20 logging with multi-process sh…
  5. Oct 12, 2026Cheap alternative to reboot parameters (nohz, rcu, isolcpus) for stable benchmarks When no…
  6. Oct 12, 2026This C++ drama is crazy - Adobe votes no https://www.youtube.com/watch?v=DEqx_NMMH9Q https…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →