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

  Function declare that it can throw an ioexception

Every C++ function that performs file I/O will thus need to either declare that it can throw an IOException, or contain a try-catch-finally block to deal with it. Response?

  Create a customer profile class.

a. Create a CustomerProfile class. Each CustomerProfile contains a last name, phone number, and bit fields indicating whether the customer:

  Three or more dimensions

What kind of program, or problem, might necessitate arrays of three or more dimensions?

  Calculation of mortgage interest rates

Instruction of pointers and the calculation of mortgage interest rates.

  Pros and cons of choosing two servers

Classify the two alternatives in terms of what type of application architecture they use. b. Outline the pros and cons of the two alternatives and make a recommendation to Fred about which is better.

  Write a program that skip s leading whitespace character

a) Write a program that skip s leading whitespace character s in each line of the pro vided data file CPPHumor .txt . Save the results in a new file

  Programmingto compute the volume of water in the cubic feet

Write down an algorithm (Programming in C) in order to compute the volume of water in the cubic feet, flowing through a pipe of diameter d in feet, having a velocity of v feet per second.

  C assignment of curl library

C Assignment Curl library must be used To be done on linux, it should be compiled using the following command: gcc -Wall -ansi -pedantic NameOfFile.c -lncurses Please make sure it is commented with clarification Variable names in camel case

  Write program to read from file to find number of integers

Write down the program which reads from file numbers.txt 30 integers in range 0 - 200. Program ‎then determines number of integers in each of given ranges.

  Define a structure to store marks of a student

Define a structure to store roll no, name and marks of a student - using the structure of Q2. a), above write a 'C' program to create a file "student.dat". There must be one record for every student in the file.

  Implement database having array of pointers

One way to implement this database is to have an array of pointers pointing to Employee objects. You will obviously require a function named Calculate_salary() which will be different for each employee class. Write code in c++

  Write a program to calculate existing angles

Write a program to calculate existing angles and do if and then from this, and to place fixed angles at certain position.

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