Develop a program that when you pipe in a file

Assignment Help C/C++ Programming
Reference no: EM13162997

develop a program that when you pipe in a file it will demonstrate on the left had side the line number. I need this to work by having a program piped in and when a \n occurs a new line and number is indicated. Someone helped me earlier but that was only for character by character. for line by line. I know the basic set up I need need help executing this program.

 

#include <stdio.h>

#include<string.h>

 

int main(){

char inp[1000];

int i;

printf("Enter the input:\n");

scanf("%s", &inp);

for(i = 0; i < strlen(inp); i++){

printf("%d %c\n", i + 1, inp[i]);

}

return 0;

}

 

 

Reference no: EM13162997

Questions Cloud

Describe the content, purpose, user access methods : describe the content, purpose, user access methods, and sources of data
Calculate the number of grams of sodium used in the reaction : The hydrogen gas generated is collected over water at 25.0°C. The volume of the gas is 295 mL measured at 1.00 atm. Calculate the number of grams of sodium used in the reaction. (Vapor pressure of water at 25°C = 0.0313 atm.)
What is the molecular weight of the gas : 2.58g of a gas has a volume of 3.97L at 745mmHg and 21 degrees celcius. What is the molecular weight of the gas?
How much potassium chlorate is needed to produce : The decomposition of potassium chlorate (KClO3) is used as a source of oxygen in the laboratory. How much potassium chlorate is needed to produce 20.7 mol of oxygen?
Develop a program that when you pipe in a file : develop a program that when you pipe in a file it will demonstrate on the left had side the line number  work by having a program piped in and when a \n occurs a new line and number is indicated.
Determine the gram-formula mass of the product : Determine the gram-formula mass of the product of this reaction. Include proper units.
What is the pressure of a container : What is the pressure of a container that has 7 atm pressure coming from O2, 2 atm of pressure coming from N2, 3 atm of pressure coming from CO2?
What is the specific heat for the metal : It takes 47.0 J to raise the temperature of an 9.00 g piece of unknown metal from 13.0rm ^circ C to 25.0^circ{C}. What is the specific heat for the metal?
Calculate the mass of propylene glycol : Calculate the mass of propylene glycol ({rm{C}}_3 {rm{H}}_8 {rm{O}}_2 ) that must be added to 0.340 kg of water to reduce the vapor pressure by 2.86 torr at 40 ^circ ,{rm C} (P_{{rm H}_2{rm O}} at 40 ^circ,{rm C} = 55.3;{rm torr}).

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Calculate the component voltages

Calculate the component voltages for the following series resonant RLC circuit

  Lu decomposition with gauss elimination

The LU decomposition with Gauss elimination and what is the physical interpretation of the elements of ? Write C++ programs for steps 2, 3, and 4.

  Object oriented programming paradigm is better choice

Explain why object oriented programming paradigm is considered better choice than structured programming paradigm. Does it reflect our "natural" way of thinking or do you find it artificial?

  The process function will then need

The process function will then need to find the time the person waited by calling the time function and finding the difference between the start and end timestamps. Save this time to an accumulator so that in the end you can find the average wait tim..

  Write the class definition for a class called complex

. Write the class definition for a class called complex.

  Write song playlist class-object-oriented design principles

Write a song playlist class in C++ called "PlayList" using object-oriented design principles. The playlist should support the following ADT.The implementation should be based on an array of strings to store the song titles.

  Writing a program that creates a linked list

Writing a program that creates a linked list from 100 randomly generated numbers and sorts the using a heap. One heap in ascending order and one heap in descending order. Then displays the original linked list and both sorted lists.

  Implement the guess the word

Implement  the ‘Guess the Word' game in an object-oriented manner

  Program to compute surface area of sphere using function

Write down a program in C++ to compute surface area of sphere using a function. As sample run, write down the surface areas of spheres with radii.

  First display the smallest volume and then the largest volum

first display the smallest volume and then the largest volume.

  Prepare an accounting for a dorm''s kitchen

The "purpose" of the program is to prepare an accounting (database) for e.g. a dorm's kitchen, to keep track of the consumption of beer for each room.

  Complete the payroll program with following driver object

complete the payroll program with the following driver objects.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd