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.
Mesic_Klassen_1.cpp
- Committer:
- mirzamesic
- Date:
- 2020-04-21
- Revision:
- 1:8e854723c742
File content as of revision 1:8e854723c742:
#include <stdio.h> #include <iostream> using namespace std; enum eckig { ja, nein}; namespace Mesic { class Kreis { private: float m_radius; eckig m_hat_ecken; public: float berechneUmfang(); float berechneFlaeche(); eckig eckingauslesen(); Kreis(float radius); Kreis(float radius, eckig hat_ecken); Kreis(); }; } using namespace Mesic; Kreis::Kreis(float radius) { m_radius = radius; m_hat_ecken = nein; } Kreis::Kreis(float radius,eckig hat_ecken) { m_radius = radius; m_hat_ecken = nein; } Kreis::Kreis() { m_radius = 0; m_hat_ecken = nein; } float Kreis::berechneUmfang() { return (m_radius * m_radius * 3.1415); } eckig Kreis::eckingauslesen() { return(m_hat_ecken); } int main () { eckig eck; Kreis meineForm(2.0); float um = meineForm.berechneUmfang(); printf ("Der Umfang beträgt: %f\n", um); eck=meineForm.eckingauslesen(); if(eck==0) printf ("Es ist eckig\n"); else if(eck==1) printf("Es ist nicht eckig\n"); return 0; }