Please explain this code: #include # define SIZE 30 using namespace std; int main() {  int stud_test[SIZE];  int index_stud;  int r1=0,r2=0,r3=0,r4=0,r5=0,r6=0,r7=0,r8=0;    cout<<"Please enter the number of students: ";  cin>>index_stud;    //input  for(int i=0;i

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please explain this code:

#include<iostream>

# define SIZE 30

using namespace std;

int main()

{

 int stud_test[SIZE];

 int index_stud;

 int r1=0,r2=0,r3=0,r4=0,r5=0,r6=0,r7=0,r8=0;

 

 cout<<"Please enter the number of students: ";

 cin>>index_stud;

 

 //input

 for(int i=0;i<index_stud;i++)

 {

  cout<<"Enter the marks: ";

  cin>>stud_test[i];

 }

 

 for(int i=0;i<index_stud;i++)

 {

  if((stud_test[i]>=0) && (stud_test[i]<=24) )

  r1=r1+1;

  

  else if((stud_test[i]>=25) && (stud_test[i]<=49))

  r2=r2+1;

  

  else if((stud_test[i]>=50) && (stud_test[i]<=74))

  r3=r3+1;

  

  else if((stud_test[i]>=75) && (stud_test[i]<=99))

  r4=r4+1;

  

  else if((stud_test[i]>=100) && (stud_test[i]<=124))

  r5=r5+1;

  

  else if((stud_test[i]>=125) && (stud_test[i]<=149))

  r6=r6+1;

  

  else if((stud_test[i]>=150) && (stud_test[i]<=174))

  r7=r7+1;

  

  else if ((stud_test[i]>=175) && (stud_test[i]<=200))

  r8=r8+1;

  

 }

 cout<<"Number of students which lie in 00-24: "<<r1<<endl;

 cout<<"Number of students which lie in 25-49: "<<r2<<endl;

 cout<<"Number of students which lie in 50-74: "<<r3<<endl;

 cout<<"Number of students which lie in 75-99: "<<r4<<endl;

 cout<<"Number of students which lie in 100-124: "<<r5<<endl;

 cout<<"Number of students which lie in 125-149: "<<r6<<endl;

 cout<<"Number of students which lie in 150-174: "<<r7<<endl;

 cout<<"Number of students which lie in 175-200: "<<r8<<endl;

}

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education