Question
Functional Programming Use: C++ Functional programming is all about composition. To compose functions, they need to return a type; you cannot compose functions that don't
Functional Programming
Use: C++ Functional programming is all about composition. To compose functions, they need to return a type; you cannot compose functions that don't return anything (i.e. void).
Q: Write a program that reads table with given columns from input stream. Columns are name(note: firstname and lastname are in one column, so use getline maybe), amount, debt. Then filter the table (condition: debt is equal to 0). After that increase debt by 42% then print results.
Input:
5 Solomon Anderson 411889 36881 Jill Mitten 121877 0 Katie Nicholson 783887 591951 Ben Hen 445511 0 Adam Millington 818507 276592
Output:
Solomon Anderson 411889 52371.02 Katie Nicholson 783887 840570.42 Adam Millington 818507 392760.64
-----------------------------------------------------------------------------------
Think of what you need:
- you need to know how many lines of input you have
- convert N lines of input into some form of list with N elements
- filter a list of N such elements and reduce it to a list with M elements
- modify that list (commonly referred to as "map" the list) - you need to print the list.
So you should get print( map( filter( readLines( getInputSize() ) ) ) ) in the main section.
**PLEASE READ CAREFULLY BEFORE ANSWERING**
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