C (++) - Forenspiel

    Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

    • Quellcode

      1. #include <iostream>
      2. class C_Rechner
      3. {
      4. private:
      5. int x, y;
      6. public:
      7. int addieren(int zahl1, int zahl2);
      8. int subtrahieren(int zahl1, int zahl2);
      9. };
      10. int C_Rechner::addieren(int zahl1, int zahl2)
      11. {
      12. return zahl1 + zahl2;
      13. }
      14. char digitToChar (int i)
      15. {
      16. return (0 <= i <= 9) ? i["0123456789"] : 0;
      17. }
      18. void Push()
      19. {
      20. std::cout << "Der klaegliche Versucht das Spiel wieder zum Leben zu erwecken\n" << endl;
      21. }
      22. int main(int argc, char **argv)
      23. {
      24. int x=42;
      25. int i=0;
      26. char name[16];
      27. std::cout << "the answer to life the universe and everything is " << static_cast<char>(x) << std::endl;
      28. while(i <= x)
      29. {
      30. std::cout << "Hallo Easy-Coding.de\n";
      31. if (i == (x/2)) {
      32. std::cout << "Halbzeit fuer Easy-Coding.de\n";
      33. }
      34. i++;
      35. }
      36. cout << "Sag mir deinen Namen und ich sag dir, wie du heißt!\n"
      37. std::cin.get(name, sizeof(name));
      38. Push();
      39. return(0);
      40. }
      Alles anzeigen
    • Quellcode

      1. #include <iostream>
      2. class C_Rechner
      3. {
      4. private:
      5. int x, y;
      6. public:
      7. C-Rechner();
      8. int addieren(int zahl1, int zahl2);
      9. int subtrahieren(int zahl1, int zahl2);
      10. };
      11. C_Rechner::C_Rechner()
      12. {
      13. //Standartwerte übegeben
      14. x=100;
      15. y=100;
      16. }
      17. int C_Rechner::addieren(int zahl1, int zahl2)
      18. {
      19. return zahl1 + zahl2;
      20. }
      21. char digitToChar (int i)
      22. {
      23. return (0 <= i <= 9) ? i["0123456789"] : 0;
      24. }
      25. void Push()
      26. {
      27. std::cout << "Der klaegliche Versucht das Spiel wieder zum Leben zu erwecken\n" << endl;
      28. }
      29. int main(int argc, char **argv)
      30. {
      31. int x=42;
      32. int i=0;
      33. char name[16];
      34. std::cout << "the answer to life the universe and everything is " << static_cast<char>(x) << std::endl;
      35. while(i <= x)
      36. {
      37. std::cout << "Hallo Easy-Coding.de\n";
      38. if (i == (x/2)) {
      39. std::cout << "Halbzeit fuer Easy-Coding.de\n";
      40. }
      41. i++;
      42. }
      43. cout << "Sag mir deinen Namen und ich sag dir, wie du heißt!\n"
      44. std::cin.get(name, sizeof(name));
      45. Push();
      46. return(0);
      47. }
      Alles anzeigen