Question

I need to two arrays. The first one is one dimensional and stores 5 full names,...

I need to two arrays. The first one is one dimensional and stores 5 full names, so a string, the second one is a two dimensional array that stores 5 grades of each of the 5 people whose names are in the first array. A person’s name and list of of grades should share the same index in their respective array. So like if the bane “Mary Jones” is at position 2 of the first one dimensional array, then her 5 grades should be store at row two of the two dimensional array. The names and values are obtained by keyboard.
I am trying to use a loop but I don’t know how to store this information.

C++ PLEASE
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Output will be like:

Code will be like:

// GRadesArayCplus.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<iostream>
#include<string> // for string class
using namespace std;
void main()

{


   string names[5];

   int marks[5][5];

   for (int i = 0; i < 5; i++)
   {
       cout << "Enter the name ";
       cin>>names[i];

   }

   for (int i = 0; i < 5; i++)
   {
       for (int j = 0; j < 5; j++)
       {
           cout << "Enter marks ";
           cin >> marks[i][j];
              
       }
      
   }


   for (int i = 0; i < 5; i++)
   {
       for (int j = 0; j < 5; j++)
       {
           cout << marks[i][j];

       }
       cout << "\n";

   }

}

Please rate it if the above solution helps you in any way or if you have any concerns comment it, I will help you through again.

Add a comment
Know the answer?
Add Answer to:
I need to two arrays. The first one is one dimensional and stores 5 full names,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • IN JAVA WITH COMMENTS, The assignment: This program inputs the names of 5 students and the...

    IN JAVA WITH COMMENTS, The assignment: This program inputs the names of 5 students and the (integer) grades they earned in 3 tests. It then outputs the average grade for each student. It also outputs the highest grade a student earned in each test, and the average of all grades in each test. Your output should look like this: Mary's average grade was 78.8% Harry's average grade was 67.7% etc... : In test 1 the highest grade was 93% and...

  • /** * A collection of methods related to multi-dimensional arrays. */ public class Array2Lab { /**...

    /** * A collection of methods related to multi-dimensional arrays. */ public class Array2Lab { /** * Return whether k is in list. * Precondition: the elements of list are not null. * @param list the array to be searched. * @param k the number to search for. * @return true if k is an element of list, and false otherwise. */ public static boolean contains(Object[][] list, Object k) { return false; }    /** * Create a String that...

  • Arrays in Functions 2. Arrays in Functions You can use both the array index variables and...

    Arrays in Functions 2. Arrays in Functions You can use both the array index variables and the entire array itself as arguments to functions. The following program updates the elements of the array grades, one-by-one. Thus, we have used a call-by-reference-ish mechanism to update the values (although no & was used). Note that there is a major difference between the grade in the function call and the one in the function definition. In the statement get_grade (grades[i]); "grades" is the...

  • C++ Single Dimensional Arrays

    Exercise #1: Design and implement a program (name it AssignGrades) that stores and processes numeric scores for a class. The program prompts the users to enter the class size (number of students) to create a single-dimensional array of that size to store the scores. The program prompts the user to enter a valid integer score (between 0 and 100) for each student. The program validates entered scores, rejects invalid scores, and stores only valid scores in the array.  The program...

  • 7) Implement a two-dimensional grid with a one dimensional array. a) Implement an empty array of...

    7) Implement a two-dimensional grid with a one dimensional array. a) Implement an empty array of four integers. D) Request four integers from the console and store them into the array. In this array, the index represents a column, the value a row. c) Implement an output function to display the array as a two-dimensional grid of X's and dots where x is an array coordinate. Example output (input is bold and italicized) : Enter 4. row values (from 0...

  • how do i do this in basic java without using hashmat or anything complicated Two-Dimensional Arrays....

    how do i do this in basic java without using hashmat or anything complicated Two-Dimensional Arrays. Write the three functions described below. Demonstrate that your code works by calling each function and printing out the results. All of your code should be in one file. Upload your java code and a file containing the output of running your program to show that it works. Write a function called create2DIntArray that creates a two-dimensional array of integers between 0 and 10....

  • IN PYTHON PLEASE...... Process bowlers and their 3 bowling scores. Use my data file below: bowlers2.txt...

    IN PYTHON PLEASE...... Process bowlers and their 3 bowling scores. Use my data file below: bowlers2.txt ( Showed below) And you can also use a while loop to read your file if you prefer. How to average down an array, which you don’t have to do. In this case that would be the game 1 average for all bowlers for example. Find the low average and high average. Start with read the data into arrays/lists and printed out the arrays/lists...

  • Lab 2: (one task for Program 5): Declare an array of C-strings to hold course names,...

    Lab 2: (one task for Program 5): Declare an array of C-strings to hold course names, and read in course names from an input file. Then do the output to show each course name that was read in. See Chapter 8 section on "C-Strings", and the section "Arrays of Strings and C-strings", which gives an example related to this lab. Declare the array for course names as a 2-D char array: char courseNames[10] [ 50]; -each row will be a...

  • Write a java program that specifies three parallel one dimensional arrays name length, width, and area....

    Write a java program that specifies three parallel one dimensional arrays name length, width, and area. Each array should be capable of holding a number elements provided by user input. Using a for loop input values for length and width arrays. The entries in the area arrays should be the corresponding values in the length and width arrays (thus, area[i] =   length [i]* width [i]) after data has been entered display the following output: (in Java)

  • Write a C++ program that asks user number of students in a class and their names....

    Write a C++ program that asks user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’ names and ranking. Follow the Steps Below Save the project as A4_StudentRanking_yourname....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT