Nicholas Outram
/
Task137
Initial version
main.cpp@1:f5c439cee163, 2017-07-13 (annotated)
- Committer:
- noutram
- Date:
- Thu Jul 13 14:47:23 2017 +0000
- Revision:
- 1:f5c439cee163
- Parent:
- 0:6fc3498f36e2
updated for mbed-os 5.5
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 | 0:6fc3498f36e2 | 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 | } |