Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Array entry displaying issue in C++ I completed all the work for this assignment, but the entry from user input is not displaying properly like
Array entry displaying issue in C++ I completed all the work for this assignment, but the entry from user input is not displaying properly like the rest of the values already in the array. This is what i was tasked to do first: Add a prompt to ask the user to input their last name (no spaces ; please use underscores if needed), age and a balance of their choice. Create a new entry in the patient_list array with this information
////////////////////////////////////////Code below////////////////////////////////////////////
#include#include #include using namespace std; // Declaring a new struct to store patient data struct patient { int age; char name[20]; float balance; };
int main() { int total_patients = 6; // Storing some test data struct patient patient_list[6] = { {25, "Juan Valdez ", 1250}, {15, "James Morris ", 2100}, {32, "Tyra Banks ", 750}, {62, "Mario O'Donell", 375}, {53, "Pablo Picasso ", 615} }; // Prompt user for information cout > patient_list[5].name; cout > patient_list[5].age; cout > patient_list[5].balance; coutfor (int i = 0; ireturn 0; } ///////end of code////////////// This is what my output looks like:
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