Initial version
Fork of Task137 by
main.cpp@2:f9e74411371b, 2019-09-11 (annotated)
- Committer:
- noutram
- Date:
- Wed Sep 11 14:22:43 2019 +0000
- Revision:
- 2:f9e74411371b
- Parent:
- 0:6fc3498f36e2
2019
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| noutram | 0:6fc3498f36e2 | 1 | #include "mbed.h" |
| noutram | 0:6fc3498f36e2 | 2 | |
| noutram | 0:6fc3498f36e2 | 3 | Serial pc(SERIAL_TX, SERIAL_RX); |
| noutram | 0:6fc3498f36e2 | 4 | |
| noutram | 0:6fc3498f36e2 | 5 | char nameStr[30]; // array of chars (string) |
| noutram | 0:6fc3498f36e2 | 6 | int age; // integer to hold your age |
| noutram | 0:6fc3498f36e2 | 7 | |
| noutram | 0:6fc3498f36e2 | 8 | void getData() |
| noutram | 0:6fc3498f36e2 | 9 | { |
| noutram | 2:f9e74411371b | 10 | pc.scanf("%s %d", nameStr, &age); |
| noutram | 0:6fc3498f36e2 | 11 | } |
| noutram | 0:6fc3498f36e2 | 12 | |
| noutram | 0:6fc3498f36e2 | 13 | int main() |
| noutram | 0:6fc3498f36e2 | 14 | { |
| noutram | 0:6fc3498f36e2 | 15 | getData(); |
| noutram | 0:6fc3498f36e2 | 16 | |
| noutram | 0:6fc3498f36e2 | 17 | pc.printf("Hello %s \n\r", nameStr); |
| noutram | 0:6fc3498f36e2 | 18 | pc.printf("You are %d \n", age); |
| noutram | 0:6fc3498f36e2 | 19 | } |
