$24
Write a program named textanalyzer.c that prompts the user to enter a sentence of their choosing. The program needs to capture the input as a string,
that needs to be typedefed. Furthermore, the program needs to output the string to the stdout(1%).
Next, the program needs to output the number of characters in the underlying string.
Write a function GetNumOfCharacters that returns the number of characters in the user's string. Use a for loop in this function. (1%)
Finally, the program needs to put out the inputted string without whitespaces and tabs using a function OutputWithoutWhitespace function (1%).
Here is an example with input in italics:
Enter a sentence or phrase:
The only thing we have to fear is fear itself.
You entered: The only thing we have to fear is fear itself.
Number of characters: 47
String with no whitespace: Theonlythingwehavetofearisfearitself.
Part 2:
This program already has a macro that determines whether or not an unsigned int is odd by examining the least significant binary digit.
It is missing the macros for determining if the Nth least significant bit is set (counting N from the least significant bit, starting from 0),
and for determining if all bits are on in a range of positions.You must add those macros (3.0%)
A couple of sample runs are ...
> BitOps
Enter an integer : 31
31 is odd
Enter an integer and a bit number : 31 3
31 has bit 3 on
Enter an integer, start and end bit numbers : 31 2 4
31 has all those bits on
> BitOps
Enter an integer : 30
30 is even
Enter an integer and a bit number : 30 6
30 has bit 6 off
Enter an integer, start and end bit numbers : 30 4 6
30 has not all those bits on
Remarks:
The assignment is due next Friday, Oct. 22th, 11:59PM.
You need to submit the textanalyzer.c and the bitops.c files with the corresponding C code using submit2 (Please DO NOT submit compiled executables)!
Furthermore, the C code needs to compile without any warnings w -Wall (otherwise the TAs will not consider it)!