C Programming Language
C Programming Language
2nd Edition
ISBN: 9780131103627
Author: Brian W. Kernighan, Dennis M. Ritchie, Dennis Ritchie
Publisher: Prentice Hall
bartleby

Concept explainers

Question
Book Icon
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).

Blurred answer
Students have asked these similar questions
with c++ use loob while Write a program to print the square and the cube of a series of numbers (1,2,3..5), but it displays the output in a table of three columns. The first column presents the numbers; the second column presents the square of the numbers while the third column presents the cubic of the same number.
1. Write a c program that accepts a string from the user and outputs the length ( do not use any buit-in functions ) (Hint you may use while loop – while the character read is not equal to ‘\0’ increment the count. ) 2. Using the code above. Add additional codes that will copy the characters in reverse order (Note: Write comments that explain what each main section of the code is   accomplishing and how)
Write a c++ program that asks the user to enter a sentence and two words. The task is to replace the first word within the sentence with the second word and print the new string. Otherwise, print an error message that the word is not found. example: Write a program that asks the user to enter a sentence and two words. user programmer   Write a program that asks the programmer to enter a sentence and two words.
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr