Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Vunic_01_Klassen_Namespace.cpp
00001 #include <stdio.h> 00002 #include <iostream> 00003 00004 using namespace std; 00005 00006 enum eckig {ja, nein}; 00007 00008 namespace vunic { 00009 00010 class Kreis 00011 { 00012 private: 00013 float m_radius; 00014 eckig m_hat_ecken; 00015 00016 public: 00017 Kreis(float radius); 00018 Kreis(); 00019 Kreis(eckig x); 00020 00021 int neu(); 00022 float berechneUmfang(); 00023 eckig hat_ecken(); 00024 00025 }; 00026 00027 Kreis::Kreis(float radius) { 00028 m_radius = radius; 00029 m_hat_ecken = nein; 00030 } 00031 00032 Kreis::Kreis() { 00033 m_radius = 0; 00034 m_hat_ecken = nein; 00035 } 00036 Kreis::Kreis(eckig x){ 00037 m_radius = 3; 00038 m_hat_ecken =x; 00039 } 00040 00041 float Kreis::berechneUmfang() { 00042 return (m_radius * m_radius * 3.1415);} 00043 00044 eckig Kreis::hat_ecken(){ 00045 return m_hat_ecken; 00046 } 00047 } 00048 00049 int main () 00050 { 00051 using namespace vunic; 00052 Kreis meineForm(2.0); 00053 float um = meineForm.berechneUmfang(); 00054 printf ("Der Umfang beträgt: %f\n", um); 00055 00056 Kreis meinKreis(); 00057 eckig eck = nein; 00058 Kreis kr (eck); 00059 printf ("Ecken: %i\n", kr); 00060 00061 eckig ergebnis = kr.hat_ecken(); 00062 printf ("Ergebnis: %i\n", ergebnis); 00063 00064 return 0; 00065 }
Generated on Fri Aug 12 2022 22:42:09 by
