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
Point mode allows you to select cells for use in a formula by using your finger or the pointer
Serga [27]
That statement is true

in excel, you could enter point mode by pressing any keyboard navigation such as page down, page up, or the arrow keys or by clicking any cells in the worksheet

This mode will select a cell or range as formula operand


7 0
3 years ago
When a program uses a ____, it reads all the records in the file from beginning to end, processing them one at a time. Group of
DIA [1.3K]

Answer:

nooo noob 2+2=5

Explanation:

why noob bullly bully

4 0
3 years ago
Ingrid started speaking about her slide presentation. When she clicked to th
german

Answer: B add presenters notes

8 0
3 years ago
Read 2 more answers
Como puedo poner fondo a mi teclado​
nikdorinn [45]

CAN YOU TRANSLATE IT TO ENGLISH PLEASE SO I CAN AWANSER

7 0
3 years ago
. What year did the USA host World Cup? Right answer 1994
Ksivusya [100]

Answer:

USA host World Cup in 1994 1994 FIFA World Cup

Explanation:

USA host World Cup in 1994 FIFA World Cup

it was the 15th edition of FIFA World Cup

and Brazil was won the tournament

Brazil beat Italy by 3–2 in  penalty shoot-out

it was play between 17 June to 17 July and 24 team play this World Cup

and there matches played = 52

and 9 cities host this game

United States of America was chosen as the host by FIFA on the 4 July, 1988

5 0
3 years ago
Other questions:
  • Circular errors are caused by adding the cell name of a/an _______ cell to a formula.
    8·1 answer
  • Hailey is preparing a questionnaire on the different number systems. He asks the students to write down the correct decimal and
    7·2 answers
  • Ex. Q about the crazy effects of complements/substitutes on a wide range of goods:
    7·1 answer
  • Need help with photography
    12·1 answer
  • Write a program that sorts an array of 20 random numbersin the range from 0 through 1000.
    6·1 answer
  • 1
    13·1 answer
  • Is there any quantum computer in India?​
    9·1 answer
  • Enumera 3 exemple de operatii de lucru cu elementele grafice 3D. Repede va rog dau coroana
    15·1 answer
  • Write a new version (called map2) of the map function which operates on two lists. Your function should accept three parameters,
    15·1 answer
  • HELP!!!!!!!
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!