Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this c++ coding problem (due in a few hours!). Use only #include and #include to write it. Thank you. Task B. Counting

Need help with this c++ coding problem (due in a few hours!). Use only #include and #include to write it. Thank you.

image text in transcribedimage text in transcribed

Task B. Counting blocks opened and closed by and , and adding real indentation To count open blocks, we need to count how many curly braces get opened and closed on each line, so we need to count f and ) Write a function t countchar(string line, char c)i that scans the line and returns the number of occurrences of the character c . Write a new program indent.cpp that enhances the program from the previous task. As it reads the input line by line, it should also count the number of open and closed in it, and keep track of how many blocks is currently open at the beginning of each line. In the listing below, the number of open blocks is shown on the left 0 int main)( // Hi, I'm a program! 0 int main( 1 int x -1; 1 for int i -0; i 10; i+) 2 cout

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 Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

Effective Delivery Effective

Answered: 1 week ago