This deals with streams: input parsing.
1)
Write a single statement that reads an entire line from stdin. Assign streetAddress with the user input. Ex: If a user enters "1313 Mockingbird Lane", program outputs:
You entered: 1313 Mockingbird Lane
#include
int main(void) {
const int ADDRESS_SIZE_LIMIT = 50;
char streetAddress[ADDRESS_SIZE_LIMIT];
printf("Enter street address: ");
/* Your solution goes here */
printf("You entered: %s", streetAddress);
return 0;
}
2)
Complete scanf() to read two comma separate integers from stdin. Assign userInt1 and userInt2 with the user input. Ex: If a user enters "3, 5", program outputs:
3 + 5 = 8
#include
int main(void) {
int userInt1 = 0;
int userInt2 = 0;
printf("Enter two integers (x, y): ");
scanf(/* Your solution goes here */);
printf("%d + %d = %d\n", userInt1, userInt2, userInt1 + userInt2);
return 0;
}