Skip to content

MyUstaadG

Learn to Serve

  • Computer Science
    • Software
    • Computer Tips
    • Coding
      • Conditional Structures Exercises
      • Loops Exercises
      • Arrays Exercises
      • Python Exercises
    • Microsoft Office
      • MS Excel
      • MS Word
  • Videos
    • Funny Videos
    • Health and Fitness Videos
    • PUBG Videos
    • Technology Videos
  • News
  • Funny
  • Memes
  • Playwright Tutorials
  • Tutorials
  • Toggle search form

Write a program that uses three arrays ‘roll_no’, ‘name’ and ‘marks’. It inputs roll numbers, names and marks of 10 students into these arrays. It searches the highest marks.

Posted on October 18, 2021 By myustaadg.com
Spread the love
Write a program that uses three arrays ‘roll_no’, ‘name’ and ‘marks’. It inputs roll numbers, names and marks of 10 students into these arrays. It searches the highest marks and displays detail of the student that has highest marks such as its roll number, name, and marks. For example, if roll number is 1 and is stored in roll_no[0], then its name and marks must be stored in name[0] and marks[0] respectively.

So let’s Write Code:

Introduction to C++ Programming | Download and Install Dev C++ Compiler

Let’s build logic First:

Algorithm for code:

  • Step 1: Start
  • Step 2: Declare three arrays one for rollno, second for marks and third for names.
  • Step 3: Take inputs from user.
  • Step 4: Initialized highest_marks are equal to marks[0].
  • Step 5: Compare highest_marks value with marks[i] and store the highest value in highest_marks.
  • Step 6: Print Details of the student who has the highest marks.
  • Step 7: End Program.

Code:

Write a program that uses three arrays ‘roll_no’, ‘name’, and ‘marks’. It inputs roll numbers, names and marks of 10 students into these arrays. It searches for the highest marks.

#include<iostream>
using namespace std;
main()
{
int roll_no[10], marks[10], i, pos, highest_marks;
char names[10][25];
i = 0;
while(i<=9)
{
cout<<endl<<"Enter record of student : "<<i+1<<endl;
cout<<"Roll number : ";
cin>>roll_no[i];
cout<<"Name : ";
cin>>names[i];
cout<<"Marks : ";
cin>>marks[i];
i++;
}
highest_marks = marks[0];
i = 1;
while(i<=9)
{
if(marks[i] > highest_marks)
{
highest_marks = marks[i];
pos = i;
}
i++;
}
cout<<"\nDetail of student that has highest marks\n";
cout<<"Roll number : "<<roll_no[pos]<<endl;
cout<<"Name : "<<names[pos]<<endl;
cout<<"Marks : "<<marks[pos]<<endl;
}

Hope You will learn Something. Happy Coding.

Visit my YouTube Channel as Well😇 https://www.youtube.com/watch?v=JuIHQ9cLSEw&list=PLbIhkHxfUIItTdcyCb34uRIrPJbXBndIl&index=4

Click on the below Links for more Programming Exercises:

Conditional Structure Exercises: 👉https://myustaadg.com/category/programming-exercises/conditional-structures-exercises/

Array Exercises: 👉https://myustaadg.com/category/programming-exercises/arrays-exercises/

Arrays Exercises, Programming Exercises Tags:array declaration in c++, Array Exercises, Array exercises in C++, Arrays, arrays arrays in c++, arrays codes, Arrays exercises, Arrays in C++, Arrays in C++ Programming with examples, Arrays in Programming, Arrays with example, c++ arrays declaration and initialization, C++ Arrays with examples, C++ program to store student information using array, c++ program to store student records as structures and sort them by rollno, C++ program to to check highest marks of student, Creating and Using Arrays, how do you initialize an array in c++, names and marks in 3 subjects of n number of students in five single dimensional arrays and display the remark based on average marks, Names and Marks in 3 Subjects of N Number Students in Five Single Dimensional Array and Display the Remark Based on Average Marks, Simple arrays code, Students with maximum average score of three subjects, Write a program to input and store roll numbers

Post navigation

Previous Post: Write a program that initializes roll numbers and marks of different subjects in a two-dimensional array.
Next Post: Best Attitude Of New Outfits And New Emote In PUBG Mobile | PUBG Copyright Free Video | PUBG Copyright Free Video For YouTube Shorts

More Related Articles

Write a program that sorts one-dimensional array’s values into descending order using the bubble sort method. Arrays Exercises
Write a program that inputs data into a table and finds out the maximum and minimum values | Searching Maximum and Minimum values from a table. Arrays Exercises
Write a program that inputs values into two linear arrays. It adds the two arrays and stores the sum in the third array. Arrays Exercises
Write a program that inputs employees code, names, and salaries of 10 employees in three arrays ‘code’, ‘name’, and ‘salary’ It computes the net salary. Arrays Exercises
Write a Program to Build a Simple Calculator in Java Write a Program to Make a Simple Calculator in Java Programming Language | Solved Programming Exercises Programming Exercises
Write a program that asks the user for two numbers and shows their division on the screen. If the divisor is zero the program must display an error | Python Programming Programming Exercises

Copyright © 2022 MyUstaadG.

Powered by PressBook Blog WordPress theme