Question

C programming. please include comments

In this lab, you will learn to read data from and write data to a file - another use for pointers. SAMPLE PROGRAM There are tIn the function, you should standardize the style of the letters, capitalizing the first letter of each name, and making allOutput: nput: formatted Names. - X inputData Names....- File Edit Format View Help File Edit Format View Help eDwarD munChin

0 0
Add a comment Improve this question Transcribed image text
Answer #1
  1. #include <stdio.h>

  2. int main ()

  3. {

  4. int c = 0;

  5. char ch, s[1000];

  6. printf("Input a string\n");

  7. gets(s);

  8. while (s[c] != '\0') {

  9. ch = s[c];

  10.   if (ch >= 'A' && ch <= 'Z')

  11. s[c] = s[c] + 32;

  12.   else if (ch >= 'a' && ch <= 'z')

  13. s[c] = s[c] - 32;  

  14. c++;  

  15. }

  16. printf("%s\n", s);

  17. return 0;

  18. }

Add a comment
Know the answer?
Add Answer to:
C programming. please include comments In this lab, you will learn to read data from and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ I need a program that will read a list of names from a data file and store them in an array. You will then sort the array by last name using a quicksort, and display the results, one name per line...

    C++ I need a program that will read a list of names from a data file and store them in an array. You will then sort the array by last name using a quicksort, and display the results, one name per line.Each line has a first name and a last name.The file has 40 names in it right now, but the array should be able to accommodate up to 50 names.txt***************************************************** Barbara Wright Ian Chesterton Steven Taylor Sara Kingdom Dodo...

  • //Done in C please! //Any help appreciated! Write two programs to write and read from file...

    //Done in C please! //Any help appreciated! Write two programs to write and read from file the age and first and last names of people. The programs should work as follows: 1. The first program reads strings containing first and last names and saves them in a text file (this should be done with the fprintf function). The program should take the name of the file as a command line argument. The loop ends when the user enters 0, the...

  • Write a C++ code to make a simple program that imports the input file in and...

    Write a C++ code to make a simple program that imports the input file in and gets the results as specified Please follow the instructions and paste the code below as the answer with a screenshot of the output to prove it worked. Input file -> https://www.dropbox.com/s/444jofkchu6ylwr/names.txt?dl=0 Scoring Names You will be using the provided names.txt file, text file containing over five-thousand first names, and you will calculate a score for each name. Begin by reading the names from the...

  • Write a complete C++ program that reads students names and their test scores from an input...

    Write a complete C++ program that reads students names and their test scores from an input text file. The program should output each student’s name followed by the test scores and the relevant grade in an output text file. It should also find and display on screen the highest/lowest test score and the name of the students having the highest/lowest test score, average and variance of all test scores. Student data obtained from the input text file should be stored...

  • Need C programming help. I've started to work on the program, however I struggle when using...

    Need C programming help. I've started to work on the program, however I struggle when using files and pointers. Any help is appreciated as I am having a hard time comleting this code. #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LINE 100 #define MAX_NAME 30 int countLinesInFile(FILE* fPtr); int findPlayerByName(char** names, char* target, int size); int findMVP(int* goals, int* assists, int size); void printPlayers(int* goals, int* assists, char** names, int size); void allocateMemory(int** goals, int** assists, char*** names, int size);...

  • C++ Programming

    PROGRAM DESCRIPTIONIn this project, you have to write a C++ program to keep track of grades of students using structures and files.You are provided a data file named student.dat. Open the file to view it. Keep a backup of this file all the time since you will be editing this file in the program and may lose the content.The file has multiple rows—each row represents a student. The data items are in order: last name, first name including any middle...

  • Using C programming For this project, you have been tasked to read a text file with student grade...

    Using C programming For this project, you have been tasked to read a text file with student grades and perform several operations with them. First, you must read the file, loading the student records. Each record (line) contains the student’s identification number and then four of the student’s numerical test grades. Your application should find the average of the four grades and insert them into the same array as the id number and four grades. I suggest using a 5th...

  • please read directions first. this is supposed to be a hybrid programe add comments please JAVA...

    please read directions first. this is supposed to be a hybrid programe add comments please JAVA please add comments Programming Project 1 and Programming Project 2 "Hybrid" Your goal is to write a program that combines the functionality of both Programming Project 1andProgramming Project 2 into a single program. That is, your program should read a file ( Numbers.txt) of numbers of type double that contains some duplicates and is ordered smallest to largest. Your program should ignore the duplicate...

  • Hi the programming language for this assignment is C programming. Could you also please number the...

    Hi the programming language for this assignment is C programming. Could you also please number the answers exactly as they appear in the assignment? Thank you. (9) 1. An array of structures is needed to keep track of 50 grocery items containing the item name, item type, cost, quantity, and tax percentage for each grocery item. The following declarations have already been done: { struct grocery char name[20], type[15]: float cost, taxp: int quan: 3 Also, the following declaration has...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT