Question
Write a program to read all the characters (at most 1000) from an input file named a.txt. The program should replace every space character by
Write a program to read all the characters (at most 1000) from an input file named a.txt. The program should replace every space character by the last character of the input file.
Note: You program must only read the input file one time.
For example, if the content of the input file a.txt is:
So far the variables we had in our programs were simple variables. There are other kinds of variables and are called structured variables.
Array variables are of this kind@
The output should be:
So@far@the@variables@we@had@in@our@programs were@simple@variables.@There@are@other@kinds@of variables@and@are@called@structured@variables. Array@variables@are@of@this@kind@
Note: This is just a sample example. The last character of the file a.txt could be any printable character.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started