Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Help with Arrays

Help with Arrays

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialcssdata-structureshelplearning
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LilKoopa
    wrote on last edited by
    #1

    Hello again everyone. I appreciate the helped that I received last time but I need help again on my array programs. I was wondering if some one could tell me how to set up my arrays for the following programs I would greatly appreciate it. Here are the instructions: 1. Grade Book Create a New Project called YourLastnameGradeBook. A teacher has five students who have taken four tests. The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores. Test Score Letter Grade 90-100 A 80-89 B 70-79 C 60-69 D 0-59 F Write a program that uses a two-dimensional array of characters to hold the five student names, a single-dimensional array of five characters to hold the five students’ letter grade, and five singe-dimensional arrays of four doubles to hold each student’s set of test scores. The program should allow the user to enter each student’s name and his or her four test scores. It should then calculate and display each student’s average test score and a letter grade based on the average. Input validation: Do not accept test scores less than 0 or greater than 100. 2. Payroll Create a New Project called YourLastnamePayroll. Write a program that uses the following arrays: · empId: an array of seven long integers to hold employee identification numbers. The array should be initialized with the following numbers: 5658845 4520125 7895122 8777541 8451277 1302850 7580489 · hours: an array of seven integers to hold the number of hours worked by each employee · payRate: an array of seven doubles to hold each employee’s hourly pay rate · wages: an array of seven doubles to hold each employee’s gross wages The program should relate the data in each array through the subscripts. For example, the number in element 0 of the hours array should be the number of hours worked by the employee whose identification number is stored in element 0 of the empId array. That same employee’s pay rate should be stored in element 0 of the payRate array. The program should display each employee number and ask the user to enter that employee’s hours and pay rate. It should then calculate the gross wages for that employee (hours times pay rate) and store them in the wages array. After the data has been entered for all the employees, the program should display each employee’s identification number and gross wages. Input Validation: Do not accept negative values for hours or numbers less than 6.00 for pay rate.

    M CPalliniC D 3 Replies Last reply
    0
    • L LilKoopa

      Hello again everyone. I appreciate the helped that I received last time but I need help again on my array programs. I was wondering if some one could tell me how to set up my arrays for the following programs I would greatly appreciate it. Here are the instructions: 1. Grade Book Create a New Project called YourLastnameGradeBook. A teacher has five students who have taken four tests. The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores. Test Score Letter Grade 90-100 A 80-89 B 70-79 C 60-69 D 0-59 F Write a program that uses a two-dimensional array of characters to hold the five student names, a single-dimensional array of five characters to hold the five students’ letter grade, and five singe-dimensional arrays of four doubles to hold each student’s set of test scores. The program should allow the user to enter each student’s name and his or her four test scores. It should then calculate and display each student’s average test score and a letter grade based on the average. Input validation: Do not accept test scores less than 0 or greater than 100. 2. Payroll Create a New Project called YourLastnamePayroll. Write a program that uses the following arrays: · empId: an array of seven long integers to hold employee identification numbers. The array should be initialized with the following numbers: 5658845 4520125 7895122 8777541 8451277 1302850 7580489 · hours: an array of seven integers to hold the number of hours worked by each employee · payRate: an array of seven doubles to hold each employee’s hourly pay rate · wages: an array of seven doubles to hold each employee’s gross wages The program should relate the data in each array through the subscripts. For example, the number in element 0 of the hours array should be the number of hours worked by the employee whose identification number is stored in element 0 of the empId array. That same employee’s pay rate should be stored in element 0 of the payRate array. The program should display each employee number and ask the user to enter that employee’s hours and pay rate. It should then calculate the gross wages for that employee (hours times pay rate) and store them in the wages array. After the data has been entered for all the employees, the program should display each employee’s identification number and gross wages. Input Validation: Do not accept negative values for hours or numbers less than 6.00 for pay rate.

      M Offline
      M Offline
      Michael Schubert
      wrote on last edited by
      #2

      You're a persistent fella, aren't you?

      LilKoopa wrote:

      I appreciate the helped that I received last time

      You didn't receive any help. You received sarcastic comments and were directed to the forum guidelines. Try to figure out why and then do your homework. Edit: I just realised that you weren't directed to the forum guidelines. So, here you go: http://www.codeproject.com/script/Forums/View.aspx?fid=1647&msg=1278597[^]

      modified on Friday, October 10, 2008 5:14 AM

      L 1 Reply Last reply
      0
      • L LilKoopa

        Hello again everyone. I appreciate the helped that I received last time but I need help again on my array programs. I was wondering if some one could tell me how to set up my arrays for the following programs I would greatly appreciate it. Here are the instructions: 1. Grade Book Create a New Project called YourLastnameGradeBook. A teacher has five students who have taken four tests. The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores. Test Score Letter Grade 90-100 A 80-89 B 70-79 C 60-69 D 0-59 F Write a program that uses a two-dimensional array of characters to hold the five student names, a single-dimensional array of five characters to hold the five students’ letter grade, and five singe-dimensional arrays of four doubles to hold each student’s set of test scores. The program should allow the user to enter each student’s name and his or her four test scores. It should then calculate and display each student’s average test score and a letter grade based on the average. Input validation: Do not accept test scores less than 0 or greater than 100. 2. Payroll Create a New Project called YourLastnamePayroll. Write a program that uses the following arrays: · empId: an array of seven long integers to hold employee identification numbers. The array should be initialized with the following numbers: 5658845 4520125 7895122 8777541 8451277 1302850 7580489 · hours: an array of seven integers to hold the number of hours worked by each employee · payRate: an array of seven doubles to hold each employee’s hourly pay rate · wages: an array of seven doubles to hold each employee’s gross wages The program should relate the data in each array through the subscripts. For example, the number in element 0 of the hours array should be the number of hours worked by the employee whose identification number is stored in element 0 of the empId array. That same employee’s pay rate should be stored in element 0 of the payRate array. The program should display each employee number and ask the user to enter that employee’s hours and pay rate. It should then calculate the gross wages for that employee (hours times pay rate) and store them in the wages array. After the data has been entered for all the employees, the program should display each employee’s identification number and gross wages. Input Validation: Do not accept negative values for hours or numbers less than 6.00 for pay rate.

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        LilKoopa wrote:

        Write a program that uses a two-dimensional array of characters to hold the five student names, a single-dimensional array of five characters to hold the five students’ letter grade, and five singe-dimensional arrays of four doubles to hold each student’s set of test scores.

        That is really very basic stuff. Try to write some code and post a question whenever you meet the first obstacle. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        In testa che avete, signor di Ceprano?

        1 Reply Last reply
        0
        • L LilKoopa

          Hello again everyone. I appreciate the helped that I received last time but I need help again on my array programs. I was wondering if some one could tell me how to set up my arrays for the following programs I would greatly appreciate it. Here are the instructions: 1. Grade Book Create a New Project called YourLastnameGradeBook. A teacher has five students who have taken four tests. The teacher uses the following grading scale to assign a letter grade to a student, based on the average of his or her four test scores. Test Score Letter Grade 90-100 A 80-89 B 70-79 C 60-69 D 0-59 F Write a program that uses a two-dimensional array of characters to hold the five student names, a single-dimensional array of five characters to hold the five students’ letter grade, and five singe-dimensional arrays of four doubles to hold each student’s set of test scores. The program should allow the user to enter each student’s name and his or her four test scores. It should then calculate and display each student’s average test score and a letter grade based on the average. Input validation: Do not accept test scores less than 0 or greater than 100. 2. Payroll Create a New Project called YourLastnamePayroll. Write a program that uses the following arrays: · empId: an array of seven long integers to hold employee identification numbers. The array should be initialized with the following numbers: 5658845 4520125 7895122 8777541 8451277 1302850 7580489 · hours: an array of seven integers to hold the number of hours worked by each employee · payRate: an array of seven doubles to hold each employee’s hourly pay rate · wages: an array of seven doubles to hold each employee’s gross wages The program should relate the data in each array through the subscripts. For example, the number in element 0 of the hours array should be the number of hours worked by the employee whose identification number is stored in element 0 of the empId array. That same employee’s pay rate should be stored in element 0 of the payRate array. The program should display each employee number and ask the user to enter that employee’s hours and pay rate. It should then calculate the gross wages for that employee (hours times pay rate) and store them in the wages array. After the data has been entered for all the employees, the program should display each employee’s identification number and gross wages. Input Validation: Do not accept negative values for hours or numbers less than 6.00 for pay rate.

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          LilKoopa wrote:

          Create a New Project called YourLastnameGradeBook.

          Have you done this?

          LilKoopa wrote:

          Write a program that uses a two-dimensional array of characters to hold the five student names

          This approach is potentialy unsafe and not necessary with C++. For example:

          vector<string> names;
          string name;

          for (int x = 0; x < 5; x++)
          {
          cout << "Enter name #" << x + 1 << ": ";
          cin >> name;

          names.push\_back(name);
          

          }

          "Love people and use things, not love things and use people." - Unknown

          "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

          1 Reply Last reply
          0
          • M Michael Schubert

            You're a persistent fella, aren't you?

            LilKoopa wrote:

            I appreciate the helped that I received last time

            You didn't receive any help. You received sarcastic comments and were directed to the forum guidelines. Try to figure out why and then do your homework. Edit: I just realised that you weren't directed to the forum guidelines. So, here you go: http://www.codeproject.com/script/Forums/View.aspx?fid=1647&msg=1278597[^]

            modified on Friday, October 10, 2008 5:14 AM

            L Offline
            L Offline
            LilKoopa
            wrote on last edited by
            #5

            its done now I just wanted to know if somebody would show me how to initialize the arrays because my book didnt do a really good job explaining it to me.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups