Computer Science, asked by barnali12, 10 months ago

The following program fragment is supposed to count the number of 'a's read until the character '.' is encountered. For example, if the input is "kangaroos are fantastic.", the output should be 5.

int aCount=0;
while(true){
char c; cin >> c;
if(blankD) blankE = blankF;
}
cout << aCount << endl;

Do not use any spaces in the answers to the following questions, i.e. if you want to write p+q, do not put spaces before or after the +.



1>What is the value of blankD?

2>What is the value of blankE?

3>What is the value of blankF?

Answers

Answered by sailorking
2

Answer:

The program given in the question states that, to count the number of 'a' present in a sentence, before '.' is found. The answer for "blankD" is "(c!=' .' && c=='a')".

for "blankE" it is "aCount" and for "blankF" it is "aCount+1".

Explanation:

The reason for the answer is because, when there is character 'a' found and no '.' is present, then the the variable which is declared for counting the frequency, needs to be updated by incriminating it's value by one, which is being done, when the condition comes out to be true.

Similar questions