Please!!! need help asap!!!!
write a C++program to analyze a small subset of the data that has been collected. See file universities.txt .Use precisely seven parallel arrays: one for name of university, one for state, one for city, one for yearly tuition, one for enrollment, one for average freshman retention, and one for the percent of students who graduate with in six years.
Note that the percentage of student accepted is not stored.An output file is opened in main() and remains open until the end of the execution.
Input: Write a function to input the name of each university, the two-letter abbreviation for the state, the city, tuition, enrollment, average freshman retention rate, percent that graduate within six years.
Repeat until end of file. Assume a maximum of 1000 universities.Use getline(file, string name) to input text with spaces. You will find a very mischievous ‘\n’ character to deal with at the end of the six values. You will enjoy knowing about getline(file, tempstr);where tempstr has been declared as a string type.
Output: Write a separate function to output to the file all universities with name of university, state, tuition, enrollment, percentage retention for freshman, and percentage that have graduated after six years for each.NOTE THAT THE
universities.txt
Princeton University
NJ Princeton
41820 8014 0.0740 0.98 0.97
Harvard University
MA Cambridge
43838 19882 0.0580 0.97 0.97
Yale University
CT New Haven
45800 12109 0.0690 0.99 0.98
Columbia University
NY New York
51008 23606 0.0690 0.99 0.96
Stanford University
CA Stanford
44757 18136 0.0570 0.98 0.96
University of Chicago
IL Chicago
48253 12539 0.0880 0.99 0.93
Massachusetts Institute of Technology
MA Cambridge
45016 11301 0.0820 0.98 0.93
Duke University
NC Durham
47488 15465 0.1240 0.97 0.94
University of Pennsylvania
PA Philadelphia
47668 21358 0.1220 0.98 0.96
California Institute of Technology
CA Pasadena
43362 2181 0.1060 0.97 0.93
Dartmouth College
NH Hanover
48108 6342 0.1040 0.98 0.95
Johns Hopkins University
MD Baltimore
47060 21052 0.1710 0.97 0.93
Northwestern University
IL Evanston
47251 20997 0.1400 0.97 0.94
Washington University in St. Louis
MO St. Louis
46467 14032 0.1560 0.97 0.94
Cornell University
NY Ithaca
47286 21593 0.1560 0.97 0.93
Brown University
RI Providence
47434 8943 0.0920 0.98 0.94
University of Notre Dame
IN Notre Dame
46237 12124 0.2230 0.98 0.95
Vanderbilt University
TN Nashville
43838 12757 0.1270 0.97 0.93
Rice University
TX Houston
40566 6628 0.1670 0.97 0.91
University of California-Berkeley
CA Berkeley
25064 36204 0.1770 0.97 0.91
Emory University
GA Atlanta
45008 14513 0.2650 0.95 0.91
Georgetown University
DC Washington
46744 17849 0.1710 0.96 0.92
University of California-Los Angeles
CA Los Angeles
25064 42190 0.2040 0.97 0.90
University of Virginia
VA Charlottesville
42184 23464 0.3010 0.97 0.93
Carnegie Mellon University
PA Pittsburgh
48786 12991 0.2550 0.95 0.88
University of Southern California
CA Los Angeles
48280 41368 0.1980 0.97 0.91
CITY IS NOT OUTPUT.
Processing:
Call the output function to output to a file all data in the original order.
Write a separate function to compute and return the average tuition for all universities.
Do not output from this function but return the value and print it out to the screen from main().
Write a function to ask the user for maximum he/she can pay for tuition. List to the screen the name only of all schools with that amount or less for tuition.Output is from within the function.
Write a function to prompt the user for a two-letter abbreviation for a state. Output to the file from this function all information for colleges within that state or output message “No colleges in XX state in the list”.
Write one and only one function to return the subscript of the university with the lowest tuition. There is no output in this function. Do not assume a sorted array. In main(), the name(s) of the university or universities with this low tuition and the amount of the tuition are output to the screen.
Use a selection sort to sort universities by enrollment in ascending order. This is written as a separate function with no output.
Write the sorted array to the file
THEME ISSUES one-dimensional arrays,if statements, file input,file output,searching, sorting
Absolutelyno two-dimensional arrays, no structures and no menu function.
Sample output before sorting:
University State Tuition Enrollment % Fresh %Gradeuate in sixyears
suceed
Princeton University NJ 41820.00 8014 98.00% 97.00%
Harvard University MA 43938.00 19882 97.00% 97.00%
Yale University CT 45800.00 12109 99.00% 98.00%
Columbia University NY 51008.00 23606 99.00% 96.00%
Stanford University CA 44757.00 18136 98.00% 96.00%
University of Chicago IL 48253.00 12539 99.93.00% 93.00%
Massachusetts Institute of Technology MA 45016.00 11301 98.00% 93.00%
How should you do this?Follow these steps carefully!!!!!!!
STEP 1 Write main() and call getData() function which only opens file.Debug.
STEP 2 Complete getdata().Debug.
STEP 3 Write output function.Output is directed to the output file and NOT the screen.Debug.
STEP 4 Write the function to compute the average of tuition at all schools. Output this value to the screen
from main().Debug.
STEP 5 Write a function that will output the name only of each university where the tuition is less than or equal to
the given amount. Output to the screen.
STEP 6 Write a function to prompt the user for a two-letter abbreviation for a state. Output to the file
from this function all information for colleges within that state or output message “No colleges in XX state in the
list”. Debug.
STEP 7 Write one and only one function to return the subscript of the university with the lowest tuition. There
is no output in this function. Do not assume a sorted array. In main(),the name(s) of the university or
universities with this low tuition and the amount of the tuition are output to the screen.
STEP 8 Write a separate function using the selection sort to sort universities by enrollment in ascending order.Debug
Checkpoints
Documentation throughout to explain general outline of program.Minimum of three (3) comments in each function
(Purpose: Pre: Post:)Include name, e-mail, and lab# as comment and printed to output
Function main() which implements each step outlined in the processing section of the lab write-up.
Input function fills array for names plus four numerical arrays. It should return the number ofuniversities.
Output function
Function to compute the average of tuition at all schools
Function to output to screen universities where tuition is less than or equal to given amount.
Function to prompt the user for a two-letter abbreviation for a state. Output to the file from this function
all information for colleges within that state or output message “No colleges in XX state in the list”.
Write one and only one function to return the subscript of the university with the lowest tuition. There is
no output in this function. Do not assume a sorted array. In main() the name(s) of the university or
universities with this low tuition and the amount of the tuition are outputto the screen.
Function using the selection sort to sort universities by enrollment in ascending order.
can you do according to this program
/*Using the products.txt file, write a function to input
the
info into parallel arrays. Output the entire inventory to the
screen.
· Add to this program a selection sort to output the
products
from the lowest to the highest. Output the result from main().
· Add a function that will output the quantity on hand and
the
price when given the product ID code.
· Add a function to output the product IDs and current
number
in stock for all products needing to be reordered.
*/
#include <iostream>
#include <fstream>
using namespace std;
#define MAX 50
//declare functions
int getData(ifstream& inFile, int id[], double price[], int
qty[], int rop[]);
void output(int id[], double price[], int qty[], int rop[], int
num);
int seqSearch(int id[], int n, int target);
void sortSelect(double arr[], int n, int id[], int qty[], int
rop[]);
int main(void)
{
//Declare variables
ifstream inFile;
int id[MAX];
double price[MAX];
int qty[MAX];
int rop[MAX];
int number; int target; int loc;
//Open file
inFile.open("products.txt");
if(inFile.fail())
{
cout << "No Such File" << endl;
}
//Input the entire contents of the product file
number = getData(inFile, id, price, qty, rop);
//Output each product's id, quantity on hand, re-order point, and
price
output(id, price, qty, rop, number);
//Looking for a particular product
cout << "Enter product number your are looking for: ";
cin >> target;
loc = seqSearch(id, number, target);
if(loc == -1)
cout << "No such product!" << endl;
else
cout << "Price:" << price[loc]<< " " <<
"Quantity: " << qty[loc]<< endl;
//Sort by the price of the product (low to high)
sortSelect(price, number, id, qty, rop);
//Output each product's id, quantity on hand, re-order point,
and price
output(id, price, qty, rop, number);
system("pause");
return 0;
}//main
////////////////////////////////////////
int getData(ifstream& inFile, int id[], double price[], int
qty[], int rop[])
{
/* Pre:
inFile - reference to the data file
id[] - array of product identification numbers
price[] - array of cost for each product
qty[] - array of number of product in the warehouse
rop[] - array of when to reorder that product
Post: how many products
Purpose: Input the inventory from data file
*/
int count = 0;
while ( count < MAX && !inFile.eof())
{
inFile >> id[count] >> price[count] >> qty[count]
>> rop[count];
count++;
}
return count;
}//getData
////////////////////////////////
int seqSearch(int arr[], int n, int target)
{
/* Pre: arr - array of values
n - number of defined values
target - what we are looking for
Post: Location of what we are looking for or -1 if not found
Purpose: Find the location of value
*/
int loc = -1;
for(int i = 0; i < n; i++)
{
if (target == arr[i])
loc = i;
}
return loc;
}//seqSearch
////////////////////////////////////////////////
void sortSelect(double arr[], int n, int id[], int qty[], int
rop[])
{
/* Pre: arr[] - array of values
n - number of elements
Post: Nothing
Purpose: sort elements from low to high
*/
int walker; int current;
int smallestIndex; double tempDouble; int tempInt;
for (current = 0; current < n - 1; current++)
{
smallestIndex = current;
for(walker = current + 1; walker < n; walker++)
{
if(arr[walker] < arr[smallestIndex])
smallestIndex = walker;
}//for walker
//Swap
tempDouble = arr[current];
arr[current] = arr[smallestIndex];
arr[smallestIndex] = tempDouble;
tempInt = id[current];
id[current] = id[smallestIndex];
id[smallestIndex] = tempInt;
tempInt = qty[current];
qty[current] = qty[smallestIndex];
qty[smallestIndex] = tempInt;
tempInt = rop[current];
rop[current] = rop[smallestIndex];
rop[smallestIndex] = tempInt;
}//for current
}
void output(int id[], double price[], int qty[], int rop[], int
n)
{
/* Pre:
id[] - array of product identification numbers
price[] - array of cost for each product
qty[] - array of number of product in the warehouse
rop[] - array of when to reorder that product
n - number of products in our inventory
Post: nothing
Purpose: Output the inventory to screen
*/
for (int i = 0; i < n; i++)
cout << id[i] << " " << price[i] << " "
<< qty[i] <<" " << rop[i] << endl;
return;
}//output
#include <iostream>
#include <string>
#include <fstream>
#include <stdlib.h>
#define MAX 50
using namespace std;
//count < MAX &&
// Functions prototype
int readData(ifstream& , string [], string [], string [],
int[], int[], float[], float[]);
void writeData(ofstream& , string [], string [], int[], int[],
float[], float[], int);
void displayData(string [], string [], string [], int[], int[],
float[], float[], int);
double averageTution(int [], int);
void stateInfo(ofstream &, string [], string [], string[],
int[], int[], float[], float[], int);
void maxTutionPay(string [], int[], int);
int lowTuition(string [], int [], int);
void sortSelect(string [], string [], string [], int[], int[],
float[], float[], int);
// main function definition
int main()
{
// Declare stream object
ifstream inFile;
ofstream outFile;
// Declares array to store read data from file
string university[MAX];
string state[MAX];
string city[MAX];
int tuition[MAX];
int enrollment[MAX];
float avgFreRet[MAX];
float perGraduate[MAX];
// To store number of records
int counter;
// Open file for reading
inFile.open("universities.txt");
// Checks whether file can be opened or not
if(inFile.fail())
{
cout << "No Such File" << endl;
exit(0);
}
// End of if condition
// Opens the file for writing in append mode
outFile.open("universities_res.txt", std::ios::out |
std::ios::app);
// Calls the function to read the data from file and stores it in
respective arrays
// Returns number of records
counter = readData(inFile, university, state, city, tuition,
enrollment, avgFreRet, perGraduate);
// Calls the method to display the records
displayData(university, state, city, tuition, enrollment,
avgFreRet, perGraduate, counter);
// Calls the function to write the contents of the arrays to
file
writeData(outFile, university, state, tuition, enrollment,
avgFreRet, perGraduate, counter);
// Calls the function to calculate average tuition fee
double avgTution = averageTution(tuition, counter);
cout<<"\n Average Tuition Fee: "<<avgTution;
// Calls th4e function to find out maximum tuition fee can
offer
maxTutionPay(university, tuition, counter);
// Calls the function to write specified state information to
file
stateInfo(outFile, university, state, city, tuition, enrollment,
avgFreRet, perGraduate, counter);
// Calls the function to return low tuition index position
int index = lowTuition(university, tuition, counter);
cout<<"\n University: "<<university[index]<<"\n
Amount: "<<tuition[index];
// Calls the function to sort the record using selection sort
sortSelect(university, state, city, tuition, enrollment, avgFreRet,
perGraduate, counter);
// Calls the function to write the sorted record
writeData(outFile, university, state, tuition, enrollment,
avgFreRet, perGraduate, counter);
return 0;
}
// End of main function
// Function to sort the record using selection sort
void sortSelect(string university[], string state[], string city[],
int tuition[], int enrollment[], float avgFreRet[], float
perGraduate[], int counter)
{
// To store smallest index
int smallestIndex;
// Temporary variable to swap
string tempStr;
int tempInt;
float tempFloat;
// Loops till number of records minus two
for (int c = 0; c < counter - 1; c++)
{
// Sets the outer loop variable value as the smallest index
smallestIndex = c;
// Loops till number of records minus one
for(int d = c + 1; d < counter; d++)
{
// Checks if the current index position enrollment number with the
smallest index position enrollment number is less
if(enrollment[d] < enrollment[smallestIndex])
// Set the loop variable d as the smallest index position
smallestIndex = d;
}
// End of inner for loop
// Swapping process
tempStr = university[c];
university[c] = university[smallestIndex];
university[smallestIndex] = tempStr;
tempStr = state[c];
state[c] = state[smallestIndex];
state[smallestIndex] = tempStr;
tempStr = city[c];
city[c] = city[smallestIndex];
city[smallestIndex] = tempStr;
tempInt = tuition[c];
tuition[c] = tuition[smallestIndex];
tuition[smallestIndex] = tempInt;
tempInt = enrollment[c];
enrollment[c] = enrollment[smallestIndex];
enrollment[smallestIndex] = tempInt;
tempFloat = avgFreRet[c];
avgFreRet[c] = avgFreRet[smallestIndex];
avgFreRet[smallestIndex] = tempFloat;
tempFloat = perGraduate[c];
avgFreRet[c] = perGraduate[smallestIndex];
perGraduate[smallestIndex] = tempFloat;
}
// End of outer for loop
}
// End of function
// Function to return the index position of lowest tuition
fee
int lowTuition(string university[], int tuition[], int
counter)
{
// Stores the first tuition fee as the lowest tuition fee
int lowtuition = tuition[0];
// Set the index position to -1
int index = -1;
// Loops till number of records minus one
for(int c = 1; c < counter; c++)
{
// Checks if the current index position tuition fee is less than
the earlier low tuition fee
if(tuition[c] < lowtuition)
{
// Set the current tuition fee as the smallest
lowtuition = tuition[c];
// Set the loop variable value as the index
index = c;
}
// End of if condition
}
// End of for loop
// Returns the index position
return index;
}
// End of function
// Function to display the university for the tuition fee less
than the user entered tuition fee
void maxTutionPay(string university[], int tuition[], int
counter)
{
int fee;
// Accepts fee from the user
cout<<"\n Enter the maximum you can pay for tuition: ";
cin>>fee;
// Loops till number of records minus one
for(int c = 0; c < counter; c++)
{
// Checks if the current tuition fee is less than the user tuition
fee
if(tuition[c] <= fee)
cout<<university[c]<<"\t"<<tuition[c]<<endl;
}
// End of for loop
}
// End of function
// Writes the records matches user entered state name
void stateInfo(ofstream &outFile, string university[], string
state[], string city[], int tuition[], int enrollment[], float
avgFreRet[], float perGraduate[], int counter)
{
// Set the found status to zero
int found = 0;
string name;
// Accepts state name from the user
cout<<"\n Enter state name: ";
cin>>name;
// Loops till number of records minus one
for(int x = 0; x < counter; x++)
{
// Compares user entered state name with current state name if the
result is zero means matched
if(name.compare(state[x]) == 0)
{
// Set the found status to one
found = 1;
// Write the record to file
outFile<<university[x]<<"\t\t\t"<<state[x]<<"\t"<<city[x]<<"\t"<<tuition[x]<<"\t\t"<<enrollment[x]<<"\t\t"<<avgFreRet[x]<<"%\t\t"<<perGraduate[x]<<"%"<<endl;
}
// End of if condition
}
// End of for loop
// Checks if found value is zero then record not found
if(found == 0)
// Writes the message to file
outFile<<"\n No colleges in "<<name<<" state in
the list";
}
// End of function
// Function to calculate average tuition fee and return it
double averageTution(int tution[], int counter)
{
// To store total tuition fee
double total = 0;
// Loops till number of records minus one
for(int x = 0; x < counter; x++)
// Calculates total
total += tution[x];
// Returns average
return(total / counter);
}
// End of function
// Function to write records to file
void writeData(ofstream &outFile, string university[], string
state[], int tuition[], int enrollment[], float avgFreRet[], float
perGraduate[], int counter)
{
// Writes heading
outFile<<"\n University \t\t\t\t State \t Tuition \t
Enrollment \t Avg Fre Ret \t Per Graduate\n";
// Loops till number of records minus one
for(int x = 0; x < counter; x++)
// Writes record information to file
outFile<<university[x]<<"\t\t\t"<<state[x]<<"\t"<<tuition[x]<<"\t"<<enrollment[x]<<"\t"<<avgFreRet[x]<<"%\t"<<perGraduate[x]<<"%"<<endl;
}// End of function
// Function to display record information
void displayData(string university[], string state[], string
city[], int tuition[], int enrollment[], float avgFreRet[], float
perGraduate[], int counter)
{
// Displays heading
cout<<"\n University \t\t\t\t State \t City \t\t Tuition \t
Enrollment \t Avg Fre Ret \t Per Graduate\n";
// Loops till number of records minus one
for(int x = 0; x < counter; x++)
// Displays record information
cout<<university[x]<<"\t\t\t"<<state[x]<<"\t"<<city[x]<<"\t"<<tuition[x]<<"\t\t"<<enrollment[x]<<"\t\t"<<avgFreRet[x]<<"%\t\t"<<perGraduate[x]<<"%"<<endl;
}
// End of function
// Function read data from file and stores it in respective
arrays and returns number of records
int readData(ifstream& inFile, string university[], string
state[], string city[], int tuition[], int enrollment[], float
avgFreRet[], float perGraduate[])
{
// Counter for number of records. Initializes to zero
int count = 0;
string data;
double wast;
// Loops till not end of file
while (!inFile.eof())
{
// Reads data and stores in array counter position
getline(inFile, university[count]);
// Reads new line
getline(inFile, data);
inFile>>state[count]>>city[count];
// Reads new line
getline(inFile, data);
inFile >> tuition[count];
inFile>>enrollment[count];
inFile>>wast;
inFile>>avgFreRet[count];
inFile>>perGraduate[count];
// Reads new line
inFile.ignore(2);
// Increase the record counter by one
count++;
}
// End of while loop
// Returns number of records
return count;
}
// End of function
Sample Output:
University State City Tuition Enrollment Avg Fre Ret Per
Graduate
Princeton University NJ Princeton 41820 8014 0.98% 0.97%
Harvard University MA Cambridge 43838 19882 0.97% 0.97%
Yale University CT New 45800 12109 0.99% 0.98%
Columbia University NY New 51008 23606 0.99% 0.96%
Stanford University CA Stanford 44757 18136 0.98% 0.96%
University of Chicago IL Chicago 48253 12539 0.99% 0.93%
Massachusetts Institute of Technology MA Cambridge 45016 11301
0.98%
0.93%
Duke University NC Durham 47488 15465 0.97% 0.94%
University of Pennsylvania PA Philadelphia 47668 21358 0.98%
0.96%
California Institute of Technology CA Pasadena 43362 2181
0.97%
0.93%
Dartmouth College NH Hanover 48108 6342 0.98% 0.95%
Johns Hopkins University MD Baltimore 47060 21052 0.97%
0.93%
Northwestern University IL Evanston 47251 20997 0.97% 0.94%
Washington University in St. Louis MO St. 46467 14032 0.97%
0.94%
Cornell University NY Ithaca 47286 21593 0.97% 0.93%
Brown University RI Providence 47434 8943 0.98% 0.94%
University of Notre Dame IN Notre 46237 12124 0.98% 0.95%
Vanderbilt University TN Nashville 43838 12757 0.97% 0.93%
Rice University TX Houston 40566 6628 0.97% 0.91%
University of California-Berkeley CA Berkeley 25064 36204
0.97%
0.91%
Emory University GA Atlanta 45008 14513 0.95% 0.91%
Georgetown University DC Washington 46744 17849 0.96% 0.92%
University of California-Los Angeles CA Los 25064 42190 0.97%
0.9%
University of Virginia VA Charlottesville 42184 23464 0.97%
0.93%
Carnegie Mellon University PA Pittsburgh 48786 12991 0.95%
0.88%
University of Southern California CA Los 48280 41368 0.97%
0.91%
Average Tuition Fee: 44399.5
Enter the maximum you can pay for tuition: 46000
Princeton University 41820
Harvard University 43838
Yale University 45800
Stanford University 44757
Massachusetts Institute of Technology 45016
California Institute of Technology 43362
Vanderbilt University 43838
Rice University 40566
University of California-Berkeley 25064
Emory University 45008
University of California-Los Angeles 25064
University of Virginia 42184
Enter state name: NY
University: University of California-Berkeley
Amount: 25064
File universities_res.txt contents
University State Tuition Enrollment Avg Fre Ret Per Graduate
Princeton University NJ 41820 8014 0.98% 0.97%
Harvard University MA 43838 19882 0.97% 0.97%
Yale University CT 45800 12109 0.99% 0.98%
Columbia University NY 51008 23606 0.99% 0.96%
Stanford University CA 44757 18136 0.98% 0.96%
University of Chicago IL 48253 12539 0.99% 0.93%
Massachusetts Institute of Technology MA 45016 11301 0.98% 0.93%
Duke University NC 47488 15465 0.97% 0.94%
University of Pennsylvania PA 47668 21358 0.98% 0.96%
California Institute of Technology CA 43362 2181 0.97% 0.93%
Dartmouth College NH 48108 6342 0.98% 0.95%
Johns Hopkins University MD 47060 21052 0.97% 0.93%
Northwestern University IL 47251 20997 0.97% 0.94%
Washington University in St. Louis MO 46467 14032 0.97% 0.94%
Cornell University NY 47286 21593 0.97% 0.93%
Brown University RI 47434 8943 0.98% 0.94%
University of Notre Dame IN 46237 12124 0.98% 0.95%
Vanderbilt University TN 43838 12757 0.97% 0.93%
Rice University TX 40566 6628 0.97% 0.91%
University of California-Berkeley CA 25064 36204 0.97% 0.91%
Emory University GA 45008 14513 0.95% 0.91%
Georgetown University DC 46744 17849 0.96% 0.92%
University of California-Los Angeles CA 25064 42190 0.97% 0.9%
University of Virginia VA 42184 23464 0.97% 0.93%
Carnegie Mellon University PA 48786 12991 0.95% 0.88%
University of Southern California CA 48280 41368 0.97% 0.91%
Columbia University NY New 51008 23606 0.99% 0.96%
Cornell University NY Ithaca 47286 21593 0.97% 0.93%
University State Tuition Enrollment Avg Fre Ret Per Graduate
California Institute of Technology CA 43362 2181 0.93% 0.97%
Dartmouth College NH 48108 6342 0.95% 0.97%
Rice University TX 40566 6628 0.91% 0.98%
Princeton University NJ 41820 8014 0.97% 0.96%
Brown University RI 47434 8943 0.94% 0.96%
Massachusetts Institute of Technology MA 45016 11301 0.93% 0.93%
Yale University CT 45800 12109 0.98% 0.93%
University of Notre Dame IN 46237 12124 0.95% 0.94%
University of Chicago IL 48253 12539 0.93% 0.96%
Vanderbilt University TN 43838 12757 0.93% 0.96%
Carnegie Mellon University PA 48786 12991 0.88% 0.97%
Washington University in St. Louis MO 46467 14032 0.94% 0.93%
Emory University GA 45008 14513 0.91% 0.94%
Duke University NC 47488 15465 0.94% 0.93%
Georgetown University DC 46744 17849 0.92% 0.93%
Stanford University CA 44757 18136 0.96% 0.96%
Harvard University MA 43838 19882 0.97% 0.93%
Northwestern University IL 47251 20997 0.94% 0.96%
Johns Hopkins University MD 47060 21052 0.93% 0.96%
University of Pennsylvania PA 47668 21358 0.96% 0.91%
Cornell University NY 47286 21593 0.93% 0.96%
University of Virginia VA 42184 23464 0.93% 0.96%
Columbia University NY 51008 23606 0.96% 0.9%
University of California-Berkeley CA 25064 36204 0.91% 0.9%
University of Southern California CA 48280 41368 0.91% 0.9%
University of California-Los Angeles CA 25064 42190 0.97% 0.9%
Please!!! need help asap!!!! write a C++program to analyze a small subset of the data that...
write a C++program to analyze a small subset of the data that has been collected. See file universities.txt .Use precisely seven parallel arrays: one for name of university, one for state, one for city, one for yearly tuition, one for enrollment, one for average freshman retention, and one for the percent of students who graduate with in six years. Note that the percentage of student accepted is not stored.An output file is opened in main() and remains open until the...
(C++ programming) Need help with homework. Write a program that can be used to gather statistical data about the number of hours per week college students play video games. The program should perform the following steps: 1). Read data from the input file into a dynamically allocated array. The first number in the input file, n, represents the number of students that were surveyed. First read this number then use it to dynamically allocate an array of n integers. On...
In C only Please! This lab is to write a program that will sort an array of structs. Use the functions.h header file with your program. Create a source file named functions.c with the following: A sorting function named sortArray. It takes an array of MyStruct's and the length of that array. It returns nothing. You can use any of the sorting algorithms, you would like though it is recommended that you use bubble sort, insertion sort, or selection sort...
The name of the C++ file must be search.cpp Write a program that will read data from a file. The program will allow the user to specify the filename. Use a loop that will check if the file is opened correctly, otherwise display an error message and allow the user to re-enter a filename until successful. Read the values from the file and store into an integer array. The program should then prompt the user for an integer which will...
c++ please read all question edit the program to test different random sizes of the array and give me the time in a file will be like random size of the array and next to it the time it took for each size Im trying to do time analysis for Quick sort but i keep getting time = 0 also i want edit the program to test different random sizes of the array and give me the time in a...
Program in C++! Thank you in advance! Write a menu based program implementing the following functions: (1) Write a function that prompts the user for the name of a file to output as a text file that will hold a two dimensional array of the long double data type. Have the user specify the number of rows and the number of columns for the two dimensional array. Have the user enter the values for each row and column element in...
C++ programming please Write a program that will display random numbers in order from low to high. 1. Declare an integer array of size 100. Ask the user how many numbers to work with (n). It can be less than 100. 2. Generate random numbers from 10 to 50. 3. Write the random numbers to an output file named random.dat. Close the file. 4. Open random.dat for input and read the data values into your array. Pass your array to...
Hello I need a small fix in my program. I need to display the youngest student and the average age of all of the students. It is not working Thanks. #include <iostream> #include <iomanip> #include <fstream> #include <vector> #include <algorithm> using namespace std; struct Student { string firstName; char middleName; string lastName; char collegeCode; int locCode; int seqCode; int age; }; struct sort_by_age { inline bool operator() (const Student& s1, const Student& s2) { return (s1.age < s2.age); // sort...
Need C programming help. I've started to work on the program, however I struggle when using files and pointers. Any help is appreciated as I am having a hard time comleting this code. #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LINE 100 #define MAX_NAME 30 int countLinesInFile(FILE* fPtr); int findPlayerByName(char** names, char* target, int size); int findMVP(int* goals, int* assists, int size); void printPlayers(int* goals, int* assists, char** names, int size); void allocateMemory(int** goals, int** assists, char*** names, int size);...
I need a c++ code please. 32. Program. Write a program that creates an integer constant called SIZE and initialize to the size of the array you will be creating. Use this constant throughout your functions you will implement for the next parts and your main program. Also, in your main program create an integer array called numbers and initialize it with the following values (Please see demo program below): 68, 100, 43, 58, 76, 72, 46, 55, 92, 94,...