Answer:
See explaination
Explanation:
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE * file_object;
char file_name[100];
char ch;
int characters=0, words=0;
printf("Enter source file name: ");
scanf("%s", file_name); //asking user to enter the file name
file_object = fopen(file_name, "r"); //open file in read mode
if (file_object == NULL)
{
printf("\nUnable to open file.file not exist\n"); //check if the file is present or not
}
while ((ch = fgetc(file_object)) != EOF) //read each character till the end of the file
{
if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\0') //if character is space or tab or new line or null character increment word count
words++;
else
characters++; //else increment character count this assures that there is no spaces count
}
printf("The file story.txt has the following Statistics:\n"); //finally print the final statistics
if (characters > 0)
{
printf("Words: %d\n", words+1); //for last word purpose just increment the count of words
printf("Characters (no spaces): %d\n", characters);
}
fclose(file_object); //close the file object
return 0;
}
Answer:
Solution part of the question:
if(userTickets>5) //compare the value of userTickets with 5.
awardPoints = 10; // assign the 10 value to the award point
else
awardPoints=userTickets;// assign the userticket value to the awardpoint.
Output:
For the input 4 the output is 4.
For the input 5 the output is 5.
For the input 6 the output is 10.
For the input 7 the output is 10.
Explanation:
All the other part of the program is given on the question so here only if-else statement is given on the answer part. Which is pasted at the place of "/* Your solution goes here */" and the user can get the right answer.
- In the "if" statement the value of "userTickets" variable is get compared by 5 and if it is greater than 5 than variable "awardpoint" assigns the '10' value.
- Otherwise, with the help of "else" statement "userticket" variables value (which is the input value for the program) assign to the "awardpoint" variable.
(I am not sure what you are asking since question is not specific enough),
I am assuming you are asking why organizing a file on a computer is a key skill-
It is because today’s workplace should have as much organization as possible for a steady workplace and work environment, making needed files easy to access.
BLM movement and protests,
The election, school shootings, and the pandemic
Answer:
The test- driven development is basically use in the programming language for the designing various type of test cases in the computer system. The main goal of the test driven development is that it uses to make the system bug free and simple.
It basically use in the organization to avoid various duplication in the code and make the function more efficient.
The basic approach of the test driven development is that the test are develop so that it specify the function for the code to perform.