Pearson eText for C Programming Language -- Instant Access (Pearson+)
2nd Edition
ISBN: 9780137460847
Author: Dennis Ritchie, Brian Kernighan
Publisher: PEARSON+
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 1, Problem 23E
Program Plan Intro
Program Plan-
- Initialize the header files and main() function.
- Ask the user to enter the text and press the Ctrl+z to end the program.
- To define the function getline(char[], int) to store the line into array and calculate the length of the line.
- To read the line using while loop and check if there are any comments in the line, if present remove them.
- Finally prints the lines without comments.
Summary Introduction- The program takes the text line and prints the line after removing all the comments from the line.
Program Description- The purpose of the program is to take the take the text line and remove the comments using the fullwoing function-
getline(char[], int).
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
c++ code
Note:-
Do not provide handwritten solution. Maintain accuracy and quality in your answer. Take care of plagiarism.Answer completely.You will get up vote for sure.
In C++
Please use C++ for the problem below.
Chapter 1 Solutions
Pearson eText for C Programming Language -- Instant Access (Pearson+)
Ch. 1 - Run the hello, world program on your system....Ch. 1 - Prob. 2ECh. 1 - Modify the temperature conversion program to print...Ch. 1 - Write a program to print the corresponding Celsius...Ch. 1 - Prob. 5ECh. 1 - Prob. 6ECh. 1 - Write a program to print the value of EOF.Ch. 1 - Write a program to count blanks, tabs and...Ch. 1 - Write a program to copy its input to its output,...Ch. 1 - Write a program to copy its input to its output,...
Ch. 1 - Prob. 11ECh. 1 - Write a program that prints its input one word per...Ch. 1 - Write a program to print a histogram of the...Ch. 1 - Write a program to print a histogram of the...Ch. 1 - Rewrite the temperature conversion program of...Ch. 1 - Revise the main routine of the longest-line...Ch. 1 - Write a program to print all input lines that are...Ch. 1 - Write a program to remove trailing blanks and tabs...Ch. 1 - Write a function reverse(s) that reverses the...Ch. 1 - Write a program detab that replaces tabs in the...Ch. 1 - Write a program entab that replaces strings of...Ch. 1 - Write a program to fold long input lines into two...Ch. 1 - Prob. 23ECh. 1 - Write a program to check a C program for...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- (Program) Write a C++ program that accepts a string from the user and then replaces all occurrences of the letter e with the letter x.arrow_forwardUse C++ Don't use loops or arrays. (1) Use getline() to get a line of user input into a string. Output the line. Ex: Enter text: IDK if I'll go. It's my BFF's birthday. You entered: IDK if I'll go. It's my BFF's birthday. (2) Search the string (using find()) for common abbreviations and print a list of each found abbreviation along with its decoded meaning. Ex: Enter text: IDK if I'll go. It's my BFF's birthday. You entered: IDK if I'll go. It's my BFF's birthday. BFF: best friend forever IDK: I don't know Support these abbreviations: BFF -- best friend forever IDK -- I don't know JK -- just kidding TMI -- too much information TTYL -- talk to you laterarrow_forwardplease use c# (All Possible Three-Letter Words from a Five-Letter Word) Write a program that reads a five-letter word from the user and produces all possible three-letter combinations that can be derived from the letters of the five-letter word. For example, the three-letter words produced from the word “bathe” include the commonly used words “ate,” “bat,” “bet,” “tab,” “hat,” “the” and “tea,” and the 3-letter combinations “bth,” “eab,” etc.arrow_forward
- Write code to read (using the string class) three pieces of information from the user: a user’s name, its address, and its age. Then print a sentence combining all this information. c++arrow_forwardWrite a C++ program that repeatedly reads a string from standard input and compares it with the string "password1". - If the strings match, the program outputs the message, "You may proceed!", and stops. - If the strings do not match, and the user has not already made ten attempts, the program reads another string and compares with "password1" as before. - If the user's tenth attempt fails to match "password1", the program outputs the message, "Maybe next time!", and stops. Hint: Use a for loop to solve this problem. For example: Input Result password1 You may proceed! your_password monkeymonkeymonkey 1234 password1 You may proceed! x1 x2 x3 x4 x5 x6 x7 x8 x9 x99 Maybe next time!arrow_forwardi need the answer quicklyarrow_forward
- In C++ Take input a string and find the sum of digits if any present in the string. Print the sum.arrow_forwardWrite a C++ program Design and write a program that will accept a sentence as input, reverse the words and print the sentence out backwards. The individual words should not be reversed as we did in class. The words in the sentence should be in reverse order. Example Input: The movie was not very true to the book.Output: book the to true very not was movie The (NOTE: You may keep the period at the end if you want to.) Turn in your design (Flow Diagram) along with your code and screen shots. You can use a program like PowerPoint or some other drawing package for this or you can draw it by hand then take a picture and upload the picture along with your code and output. The following problem requires the file dictionary_four_letter_words.txt. (unable to attach the file, but copied some of it below) aahs aals abas abba abbe abed abet able ably abos abri abut abye abysaced aces ache achy acid acme acne acre acta acts acyl adds adit adosadze aeon aero aery afar agar agas aged agee ager ages…arrow_forwardCreate a program in c using do while and/or for loops that mimics rolling 2 dice to create 2 random numbers between 1-6. If the player "rolls" 2 of the same number they win and the program prints "you win!", if the numbers add up to 7 or 11 they lose and the program prints "you lose!", and if they roll 2 different numbers, they roll again until they win or lose.arrow_forward
- write a code snippet that can arrange the alphabet of a name entered by user in alternate case .note: ignore with spaces. Input string:Timothy olyphant . output string:TiMoThY OlYpHaNt. input string:Olga kurylenko. output string:OlGa KuRyLeNkO. by c language.arrow_forwardUSING C++ PLEASE I have asked this question 4 times and it has still been incorrect. Please check spacing and highlighted areas for common errors in code.arrow_forwardWrite the following in C++ Allow the user to enter a string with up to 100 letters. Display the user-entered string: Forward Backward Vertical As a triangle made from the letters of the string Display the number of letters in the string. Once everything above is displayed, the program will ask the user if he or she wishes to enter a different string or quit.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr