Question
**no file handelling*** Hello please do read the prompt before helping me i post my question already several times but the answer is not the
**no file handelling***
Hello please do read the prompt before helping me i post my question already several times but the answer is not the one i need i need help with assignment i have written the code i think
i did every thing correct but i don't know where i went wrong if there is anyone who can help me out plz this is my code i just want to make my code work not with file handling but only with
getchar and while loop and bitwiseoperators like i have used this is my code
#include
int main(){ char ch; int count = 0; int ascii = 0; int bit = 0; int flag = 0; int mask=1; while ((ch = getchar()) != EOF){ //read a character if(ch == '.'){ //if found a dot count = 0; while ((ch = getchar()) != EOF){ if(ch==' ') //count no of spaces count++; else break; } if(count == 2){ //if 2 spaces present -- 1 bit ascii=ascii|(2<
and this is what i need to implement
The input for your program will be a text file containing a large amount of English. Typically, an English sentence ends with a period (aka, dot). Many years ago, when people used mechanical typewriters, the proper form was to place one space between words in a sentence, but two spaces after the period at the end of the sentence. This rule is no longer taught, since word processors automatically control spacing. Your program must extract the secret message from the input file. The message is hidden inside the file using the following scheme. The message is hidden in binary notation, as a sequence of 0s and 1s. Each block of 8-bits is the ASCII encoding of a single character in the secret message. Your program will scan the input, and for each period (aka, dot) encountered, your program will count the number of spaces (ASCII 0x20) that immediately follow the dot. If the number of spaces is 0, then your program will ignore that dot completely. If the number of spaces is 1, then that corresponds to a single 0 bit of the secret message. If the number of spaces is 2, then that corresponds to a single 1 bit of the secret message. Finally, if the number of spaces is 3 or more, then that indicates that there are no more characters in the secret message. Your program must scan the input file, and output to stdout the plain text secret message. If your program successfully completes its task, then the program should return an exit status of 0 to the operating system. If the number of bits in the message is not a multiple of 8 (8 bits for each ASCII character), then your program should return an exit status of 1. If the input file does not containing the message over signal, i.e., a dot followed by 3 or more spaces, then your program should return an exit status of 2.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started