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

  Design and implement a library system

Design and implement a library system that does the following: ? Takes details of a student/library users: first name, last name, other names, user ID number, and nationality.

  Design a simple game of blackjack

Prepare a simple game of blackjack using object oriented programming.

  Write a c program which takes a string from command line

Write a c program which takes a string from command line with mainfunction has no parameter and convert the string in upperca

  Write a program that asks the user to enter the names of 3

Write a program that asks the user to enter the names of three salesmen. The program should thenaccept the sales produced for salesman for each quarter of the year. Display the name, and the totalsales amount, of each salesman.

  The use of decision logic

The use of decision logic is one of the major concepts of computer programming.

  Implement a simplified version of the set class

You will implement a simplified version of the set class. You must implement all functions defined in the provided file set.h. You may add other member functions and variables as necessary.

  Write main function to compute stress-strain in steel rod

Write a main function and the following functions to compute the stress and strain in a steel rod of diameter D (inches) and length L (inches) subject to the compression loads.

  Assign passed value to function to return value

Assign passed value to this member and another function to return value. Your main should read the integer from an input data file, and write the output to the output data file.

  Design a deck plan space ship in eclipse

Develop a simple interactive two-dimensional spaceship deck plan editor using OpenGL and GLUT. Your program will enable a user to create and save a deck plan of a hypothetical spaceship comprising the hull walls.

  Write a program that computes the cost of long distance call

Write a program that computes the cost of a long distance call. The cost of the call is determined according to the following rate schedules.

  An integer on this system is 4 bytes long

Assume the following for the program below. An integer on this system is 4 bytes long. The memory address where the array "a[]" was created begins at location 8000. a. #include

  Program to declare array alpha of components of type int

Write C++ statements to do the following: Declare an array alpha of 15 components of the type int. Output the value of the tenth component of the array alpha.

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