C Programming Language
2nd Edition
ISBN: 9780131103627
Author: Brian W. Kernighan, Dennis M. Ritchie, Dennis Ritchie
Publisher: Prentice Hall
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
Take input a string from user and reverse it without using any library functions.
Print the reversed string in output.
Code in C++
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.
Palindrome is a word that reads the same backwards and forwards e.g. MADAM, POP, TAT etc. are palindromes. Write a C++ program that checks whether a given string is a Palindrome or not using an appropriate data structure. Enter Ghazi as an input to your program and add a screen shot here which displays either its palindrome or not?
Chapter 1 Solutions
C Programming Language
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
- 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)arrow_forwardWrite 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.arrow_forwardWrite a program in C# that will take a string and a number from user as an input, and write string as many times till number is not zero. (using for loop)arrow_forward
- Create a program in C that allows the user to prompt for the input of the author's last name, the publication year, and the publication city for the book. String input should accept spaces, since both names and cities (especially in publishing) may be multi-word. You also should abide by the rules of the Prgramming Recitation 1 with regards to error trapping. Turn in your .C file and your makefile. Get used to this: Exercises will have this tendency to be pieces of the recitiation. The hope is that you will get enough out of the exercises to be able to perform the work in the recitation.arrow_forwardEnter two strings and check whether one string is the reverse of other or not. For example, consider the strings “vikas” and “sakiv”, you can notice that one string is the reverse of other(IN C LANGUAGE)arrow_forwardTake a string from user and you have to remove all the characters except the alphabet from that string. In c++ programming language.arrow_forward
- (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_forwardPalindrome is a word that reads the same backwards and forwards e.g. MADAM, POP, TAT etc. are palindromes. Write a C++ program that checks whether a given string is a Palindrome or not using an appropriate data structure. Enter your first name as an input to your program and add a screen shot here which displays either its palindrome or not? suppose your name is awaisarrow_forwardIn C++ Take a string input from user and print the Character with lowest ASCII value in output. Note : String contains UpperCase alphabets only.arrow_forward
- Programming language is C : (please write with more comments ..thank you) 1- Write a program to accept a string and count the number of vowels present in this string.arrow_forwardWrite a program in C++ which adds, subtracts, multiplies, divides and perform exponentiation on two specific numbers. The two numbers should be entered by the user. Each output should include a string describing what the numerical output is being displayed. Use the if-else-if ladder so that the user is able to select which mathematical function to perform. Make sure the program has a neat menu for the user to use to select their choice. Also, avoid having the computer perform a division by zero if the user attempts it by outputting a warning message in its place (use an if-else statement). Include your C++ source code as well as the output of your program in your submissionarrow_forwardWrite a code snippet that can arrange the alphabets of a name entered by user in alternate cases .Note: Ignore white spaces . Implement this code in C language. Input string: Timothy Olyphant Output string: TiMoThY OLyPhAnT Input string: Olga Kurylenko Output string: OlGa KuRyLeNkOarrow_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