Preview

COS wa 10

Good Essays
Open Document
Open Document
297 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
COS wa 10
COS-116-GS
Assignment 10
A).
Write a program to prompt a user for a filename. Count: the number of characters in the file (letters or numbers) the number of words in the file the number of lines in the file Print out your results on the screen.

#include
#include
int main (void) {
FILE* fin; char filename[64]; int charcount = 0; int wordcount = 0; int linecount = 0; char c; char word[64]; char line[256];

printf("Enter the input file name\n"); scanf("%s", filename);

if ((fin = fopen(filename, "r")) == NULL)
{
printf("Error opening input file\n"); return 1;
}

while (!feof(fin))
{
c = fgetc(fin); if (isalnum(c))
{
charcount++;
}
} rewind(fin); while (!feof(fin)) { fscanf(fin, "%s ", word); wordcount++; } rewind(fin); while (!feof(fin)) { fgets(line, 256, fin); linecount++; } printf("Number of characters: %d\n"
"Number of words: %d\n"
"Number of lines: %d\n", charcount, wordcount, linecount); fclose(fin); return 0;
}

B).
Create a set/list of enumerated constants called week that contains the days of the week. Have a variable called today that is of type week. Assign a value to today. If the day is Monday through Friday, print "Go to work!" If the day is Saturday or Sunday, print "You can rest today!"

#include
#include
#include
#include

void main() { printf("Enter a day of the week! (i.e. Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,Sunday)\n"); enum week {Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday};

enum week today; char todayString[16];

today = Sunday;

gets(todayString); if (stricmp(todayString,"Sunday") == 0) { today = Sunday; } if (stricmp(todayString,"Monday") == 0) { today = Monday; } if (stricmp(todayString,"Tuesday") == 0) { today = Tuesday; } if (stricmp(todayString,"Wednesday") == 0) { today = Wednesday; } if (stricmp(todayString,"Thursday") == 0) { today = Thursday; }

You May Also Find These Documents Helpful

  • Good Essays

    LOI 10-4

    • 662 Words
    • 3 Pages

    visits at each of the 50 locations. The related findings of the interviews and site visits…

    • 662 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Question and Edward Jones

    • 804 Words
    • 4 Pages

    calendar below. The calendar requires you to detail the actions you would take throughout the week. This is your opportunity to…

    • 804 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    IS 10

    • 418 Words
    • 2 Pages

    Soon after Teresa DeYoung’s husband died, her mother-in-law also died, leaving an inheritance of more than $400,000 for DeYoung’s children. DeYoung hired John Ruggerio, an attorney, to ensure that her children would receive it. Ruggerio advised her to invest the funds in his real estate business. She declined. A few months later, $300,000 of the inheritance was sent to Ruggerio. Without telling DeYoung, he deposited the $300,000 in his account and began to use the funds in his real estate business. Nine months later, $109,000 of the inheritance was sent to Ruggerio. He paid this to DeYoung. She asked about the remaining amount. Ruggerio lied to hide his theft. Unable to access these funds, DeYoung’s children changed their college plans to attend less expensive institutions. Nearly three years later, DeYoung learned the truth. Can she bring a suit against Ruggerio? If so, on what ground? If not, why not? Did Ruggerio violate any standard of professional ethics? Discuss. [DeYoung v. Ruggerio, 185 Vt. 267, 971 A. 2d 627 (2009)]…

    • 418 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Unit 10

    • 2465 Words
    • 10 Pages

    |I certify that the work submitted for this assignment is my own and research sources are fully acknowledged. |…

    • 2465 Words
    • 10 Pages
    Satisfactory Essays
  • Satisfactory Essays

    How is the job you do for the day/week given to you and how do you know what sequence to do it in?…

    • 610 Words
    • 5 Pages
    Satisfactory Essays
  • Good Essays

    Bba 340 Wa

    • 283 Words
    • 2 Pages

    Data quality assurance refers to a few different things. It can simply be the profiling of certain data to discover any inconsistencies, and anomalies in the data. It can also refer to certain cleansing activities, such as the removal of outliers in hopes of improving the data quality . Data quality assurance can help accuracy, completeness, consistency, and timeliness. In addition data quality assurance can help :…

    • 283 Words
    • 2 Pages
    Good Essays
  • Good Essays

    2. Before you make the note in Question 1, you decide to determine Friday’s date, so that you can include it in your note. What Linux command can you use to quickly determine the Friday’s date?…

    • 2601 Words
    • 11 Pages
    Good Essays
  • Satisfactory Essays

    COMM 1502 Assignment 2

    • 419 Words
    • 2 Pages

    5. Using the CountIF function in Excel count the number of clients are done on Tuesdays or Thursdays and the ones that are done on Mondays or Wednesdays and the ones that are done on Fridays and lastly the ones that are done on the weekend (Saturdays & Sundays). Put the results in a summary Table and create a separate tab in the Excel workbook for this labelled accordingly. Also show your cell formulas in Excel so she can see how you did it (you will have to create a separate tab for displaying the cell…

    • 419 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Unit 10

    • 1891 Words
    • 8 Pages

    Imagine that you are a researcher for a local radio station and you have been asked to put together a piece on looked after children and young people.…

    • 1891 Words
    • 8 Pages
    Good Essays
  • Satisfactory Essays

    FAMU Reasons

    • 179 Words
    • 1 Page

    One reason to attend FAMU is because you will be accepted like family. Once you are a Rattler, you are part of a network of students and will back you and support you. Another reason is the unique demographic of the students that attend. FAMU is one of the top 10 historically black colleges in the United States, but we all come from different backgrounds. The last and most important reason to attend FAMU, is because there is a great deal of pride exhibited by our students. Just being able to attend this school makes me and all my fellow students proud to be a Rattler! You'll receive tools you need to thrive and be successful throughout your professional career or whatever venture you may travel. Having the accessibility to learn more about…

    • 179 Words
    • 1 Page
    Satisfactory Essays
  • Good Essays

    Unit 10

    • 1111 Words
    • 5 Pages

    2.2 Describe the characteristics of the different types of schools in relation to educational stage(s) and school governance.…

    • 1111 Words
    • 5 Pages
    Good Essays
  • Good Essays

    BIS 155 Final

    • 2158 Words
    • 9 Pages

    Since this is a weekly payroll for construction workers, the computation for Excel will be on a weekly basis. Here are the insights as to how to create the Payroll…

    • 2158 Words
    • 9 Pages
    Good Essays
  • Good Essays

    Unit 10

    • 1971 Words
    • 8 Pages

    The Early Years foundation stage’s (EYFS) framework sets the standards that all Early Years providers must meet so that the children learn and develop well and are kept healthy and safe. It promotes teaching and learning to ensure children are ready for school and gives children the broad range of knowledge and skills that provide the right foundation for good future progress through school and life. This is from birth to 5 yr olds.…

    • 1971 Words
    • 8 Pages
    Good Essays
  • Good Essays

    Unit 10

    • 726 Words
    • 3 Pages

    3.1 3.2 Be able to identify and use the appropriate accounting system to meet specific organisational requirements.…

    • 726 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Counting is a skill that is practiced throughout a student’s education using a variety of methods. One particular method is rote counting or standard order principle. The standard order principle is an understanding that counting is a sequence pattern that is consistent. It always begins with the number 1, then 2 follows, 3,4,5,6, etc. Sequential counting is taught by counting by ones, fives and tens. Circle time in the beginning of the day can incorporate to do daily calendar group activity. The day of the week, the number of days in a week as well as counting the number of school days since the first day of school are all part of the daily calendar math. Counting school days can begin by counting in standard order with the first day of school. Each day can be represented by using a picture or symbol such as a picture of an apple. One green apple for each day, then a yellow apple for every 5th day and on every 10th day, a red apple is used. This visual display of counting will show student which apples to count by 1’s, 5’s and 10’s as the school year progresses.…

    • 751 Words
    • 4 Pages
    Good Essays