1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
DaniilM [7]
3 years ago
7

HW3_P1 - Student list using array

Computers and Technology
1 answer:
Greeley [361]3 years ago
3 0

Answer:

#include<iostream>

#include<cstring>

#include <algorithm>

using namespace std;

class Student{

public:

string name;

int rollNo;

Student(){

}

Student(string n, int r){

name = n;

rollNo = r;

}

};

class ClassRoom{

public:

Student stud[10];

int count;

ClassRoom(){

count = 0;

}

void addStudent(string str,int roll){

Student s(str,roll);

stud[count++] = s;

}

Student * getAllStudents(){

return stud;

}

};

int main()

{

string name;

char temp[20];

int rollNo, N, i;

Student * students;

ClassRoom classRoom;

i=0;

while(getline(cin, name) && cin.getline(temp,20)&&i<10){

rollNo = atoi(temp);

classRoom.addStudent(name, rollNo);

i++;

}

N = i;

students = classRoom.getAllStudents();

for(int i=0 ; i < N; i++){

cout << (students+i)->rollNo << " - " << (students+i)->name;

if(i<N-1)

cout<<endl;

}

return 0;

}

Explanation:

  • In the addStudent method, increment the counter and as the value of variable s to the the stud array.
  • In the getAllStudents method, return all the students.
  • Finally in the main method, display the name and roll no. of students.
You might be interested in
Help meee pleaseeee
MrMuchimi

Answer:

1. DO, RECEIVE

2. PERFORM

3. STORE, TAKE IN, CALCULATE

4. EXPRESS

5. COMPUTE, DISPLAY

Explanation:

1. A computer DO or RECEIVE data

2. Modern automatic digital computers PERFORM more than 100 mln operations in each second

3. A computer STORE information or data, TAKE IN a sequence of operations on information and CALCULATE answers.

4. The hardware inside the computer EXPRESS arithmetical operations or logical relations

5. When the computers COMPUTE results, they DISPLAY them.

1. DO, RECEIVE

2. PERFORM

3. STORE, TAKE IN, CALCULATE

4. EXPRESS

5. COMPUTE, DISPLAY

7 0
3 years ago
PLS ANSWER ASAP I WILL GIVE BRAINLIEST
vladimir1956 [14]

Answer: 'Scope' Is <u>NOT</u> a basic programming sturtcure

Explanation: Surprisingly, it can often be broken down into <u>three simple programming structures called sequences, selections, and loops</u>. ... These come together to form the most basic instructions and algorithms for all types of software.

5 0
3 years ago
Which of the following is the first step in a lockout-and-tag procedure? A. Place your lock on the breaker or switch. B. Sign yo
yKpoI14uk [10]
The answer is C. Shut off the Electricity to the machine at the breaker m. hope this helps
4 0
4 years ago
Read 2 more answers
Identify characteristics of top-down programming design. Choose all that apply.
Eva8 [605]

Answer:

The correct option is;

It is made of one or more modules.

It breaks a task into simpler and simpler steps.

Explanation:

The implementation of top-down programming approach begins from the system defining basic modules and progresses by putting in place intermediate modules that take charge of more detailed and complex activities and processes. The intermediate modules are further streamlined into more specific programming

Therefore, the top-down programming is made of one or more modules that breaks a task into simpler and simpler steps.

3 0
4 years ago
George has to develop a website for his dad’s cycle shop. He wants to focus mainly on the products and wants the website to have
irakobra [83]

Answer:

The correct answer is letter "D": George should only add images that will highlight the products.

Explanation:

Grid formats are web pages designs that instead of portraying information display pictures arranged three by three (3x3) or four by three (4x3) grids so the web page user can select one of the images that is of interest and after clicking on it details of that subject will be on the screen.

In that case, as George is using a grid format for his father's shop website, he should only add images that after been clicked will bring u the content of the corresponding product.

3 0
3 years ago
Other questions:
  • If you want three vertical sections of text on your page, create _____.
    11·2 answers
  • To what does the term computer hacking refer?
    10·2 answers
  • Which column and row references are updated when you copy the formula: =F$5+12?
    14·1 answer
  • Computer programs and games are called what?
    13·1 answer
  • PLEASE HELP THIS IS MY LAST CHANCE TO PASS MY QUIZ
    13·2 answers
  • Write a method called printGrid that accepts two integers representing a number of rows and columns and prints a grid of integer
    11·1 answer
  • What is a software? 2 sentences please, I'll mark u as brailiest
    12·1 answer
  • Select the correct answer.
    10·2 answers
  • (Please hurry will give brainliest and anything else please Due in 5 min)
    9·2 answers
  • Compare and contrast sources and types of credit, including costs and benefits of installment
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!