Use C Structure Data Program Uses Dynamic Allocation Create Array Strings Asks User Enter Q37018931

Use C++ Structure Data: the program uses dynamic allocation tocreate an array

of strings. It asks the user to enter a number and based on theentered number it

allocates the array size. Then based on that number it asks theuser that many times

to enter student’s names.

What you need to do:

Add another array of doubles to store the gpa of each student asyou

enter them

You need to display both the student’s name and the gpa.

NOTE:

must use pointer notation not array subscript

. Any submission that uses array

subscript won’t be graded


Answer


#include <iostream>

using namespace std;

int main()

{

int n;

cout<<“Enter number of students: “;

cin>>n;

string *names=new string[n];

double *grades=new double[n];

cout<<“Enter

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.