Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

getchar() redirect to input textfile in ASCI C programming. Hello, underneath is the code I did and it works. However, my professor is asking to

getchar() redirect to input textfile in ASCI C programming.

Hello, underneath is the code I did and it works. However, my professor is asking to use getchar() and have an input text file to redirect it. How would i do that on my code? Thank you for the help.

#include #include int main() { char string[100]; int c = 0, Lcase[26] = {0}, x; int Ucase[26] = {0}; printf("Enter a string "); gets(string); while (string[c] != '\0') { if (string[c] >= 'a' && string[c] <= 'z') { x = string[c] - 'a'; Lcase[x]++; } if( string[c] >= 'A' && string[c] <= 'Z') { x = string[c] - 'A'; Ucase[x]++; } c++; } for (c = 0; c < 26; c++) { printf("%c occurs %d times in the string. ", c + 'a', Lcase[c]); } for (c = 0; c < 26; c++) { printf("%c occurs %d times in the string. ", c + 'A', Ucase[c]); } return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications Dexa 2023 Workshops 34th International Conference Dexa 2023 Penang Malaysia August 28 30 2023 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Maqbool Khan

1st Edition

303139688X, 978-3031396885

More Books

Students also viewed these Databases questions

Question

Do other psychological syndromes have a place in the courtroom?

Answered: 1 week ago