Michael Planner
/
InitListen
Codeschnippseln für diese Übung
Revision 2:7a0bae2281e8, committed 2020-10-13
- Comitter:
- Aagrus
- Date:
- Tue Oct 13 16:45:15 2020 +0000
- Parent:
- 1:c65875995efb
- Commit message:
- UPDATE: String-Output, ging auch mit einem Parameter ;)
Changed in this revision
class4.cpp | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/class4.cpp Tue Oct 13 16:34:21 2020 +0000 +++ b/class4.cpp Tue Oct 13 16:45:15 2020 +0000 @@ -29,13 +29,18 @@ pc->printf("Auflistung beendet!\n\n"); } - void PrintString(char *str, int count) + void PrintString(char *str) { pc->printf("String: "); + int i = 0; - for (int i = 0; i < count; i++) + while(true) { + if (str[i] == '\0') + break; + pc->putc(str[i]); + i++; } pc->printf("\n");
--- a/main.cpp Tue Oct 13 16:34:21 2020 +0000 +++ b/main.cpp Tue Oct 13 16:45:15 2020 +0000 @@ -38,7 +38,7 @@ while (1) { - printClass.PrintString(s, sizeof(s)); + printClass.PrintString(s); printClass.PrintIntValues(68); printClass.PrintIntValues(x, sizeof(x) / sizeof(int));