Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you help me print this display in a near aligned colum format, the rest of the code is written but I cant seem to
Can you help me print this display in a near aligned colum format, the rest of the code is written but I cant seem to get this right
#include "library.h
#include
#include
void displayconst College a unsigned n
std::cout std::left std::setw "Name" std::setw "Cost" std::setw "Acceptance Rate" std::endl;
for unsigned i ; i n; i
std::cout std::left std::setw ainame std::setw$ aicost std::setw;
std::cout std::fixed std::setprecision aiacceptancerate std::endl;
double totalcost ;
for unsigned i ; i n; i
totalcost aicost;
double averagecost totalcost n;
std::cout "Average cost: $ std::fixed std::setprecision averagecost std::endl;
int searchconst College a unsigned n std::string name, std::string category
for unsigned i ; i n; i
if category "name" && ainame name
return i;
return ;
void sortbynameCollege a unsigned n
for unsigned i ; i n ; i
for unsigned j ; j n i ; j
if ajname aj name
College temp aj;
aj aj ;
aj temp;
void sortbycostCollege a unsigned n
for unsigned i ; i n ; i
for unsigned j ; j n i ; j
if ajcost aj cost
College temp aj;
aj aj ;
aj temp;
void sortbyacceptanceCollege a unsigned n
for unsigned i ; i n ; i
for unsigned j ; j n i ; j
if ajacceptancerate aj acceptancerate
College temp aj;
aj aj ;
aj temp;
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