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
Which of the following statements about light emitting in diodes is correct
andriy [413]

<span>The options attached to the question above are as follows:</span>

<span>
A. Light-Emitting diodes are used as indicators in circuits

B. Light-Emitting diodes are used as defectors in circuits

C. Light-Emitting diodes have very short life-spans in circuits

D. Light-Emitting diodes conduct current in either direction in circuits</span>

ANSWER

The correct option is A.

Light emitting diodes [LED] refers to a semi conductor diode that glows when current flows through it by converting electrical energy into light. LED has many applications and one of it is that is used as an indicator in electric circuits. The circuit symbol of LED is made up of two arrow marks, which is used to indicate the radiation that is emitted by the diode.

3 0
4 years ago
What is plagiarism? Suppose you are an online store owner &amp; you caught someone copying your store items and selling them at
olga_2 [115]

Answer:

Plagiarism is the reproduction of someone's Idea, language , work or expressions like one's original idea , language, work or expression. and not giving acknowledgment to the owner of the Idea, language, work or expression.

when someone copies your store Items and sell them at lower price the best course of action is keep your business ideas and product secrets close to yourself because you cannot have a monopoly of the market since it is an online business

Explanation:

Plagiarism is the reproduction of someone's Idea, language , work or expressions like one's original idea , language, work or expression. and not giving acknowledgment to the owner of the Idea, language, work or expression.

when someone copies your store Items and sell them at lower price the best course of action is keep your business ideas and product secrets close to yourself next time, because you cannot have a monopoly of the market since it is an online business hence there will be no action

3 0
3 years ago
what are logical and, logical or. provide real world application examples and discuss when you will use these operators?
RideAnS [48]

Both logical AND and logical OR operators evaluate a given condition and return either true or false.

The logical AND operator returns true only when both the given conditions are evaluated to be true. For instance, c<em>ondition  (10  >  5 AND 8 > 4) returns true because both the conditions with AND operator are true.</em> Now suppose the given condition is <em>(10  >  12 AND 8 > 4), it returns false because 10 is not greater than 12</em>. The AND operator returns true only when both the conditions are true; if any or both are false, false is returned.

The logical OR operator return true when either of the two conditions is true. For example, <em>the condition is (10  < 5 OR 8 > 4); it returns true because one condition is true which is 8 is greater than false</em>. It means the logical OR operator returns true if both or any of the given conditions are evaluated to be true. In case both the conditions are false in an OR statement then false is returned such as<em> (10  <  5 AND 8 < 4) returns false</em>.

You can leran more about logical operators at

brainly.com/question/13382096

#SPJ4

5 0
2 years ago
What technology uses mathematical algorithms to render information unreadable to those lacking the required key
hoa [83]

Data encryption is the name of the technology that uses mathematical algorithms to render information unreadable to those lacking the required key.

<h3>What is Data encryption technology?</h3>

This is a technology that helps to secure data by applying a technique known as cryptography. What this basically means is that a secret code (or key) is generated which would provide access to the cryptographically stored information, and failure to provide the correct key makes the data or information unreadable.

You can learn more about how data encryption works here brainly.com/question/9238983

#SPJ1

6 0
2 years ago
Drag each label to the correct location on the image. Identify parts of the table. Primary key, field, record, table.
Oksana_A [137]

Answer:

What Is It about

Explanation:

Reply ill help you Im a teacher

7 0
4 years ago
Read 2 more answers
Other questions:
  • Add the following methods to the ArrayCollection class, and create a test driver for each to show that they work correctly. In o
    5·1 answer
  • What are the features that can extend record acees beyong Organization-wide defaults?A. Criteria-based sharing rules.B. Owner-ba
    12·1 answer
  • Please I need all the help I can get Thank You So Much
    14·1 answer
  • _________ involves encouraging employees to engage in behaviors directly related to goal accomplishment.
    6·1 answer
  • Sukant’s professor asks her to take over his online class while he is away because she is an effective digital communicator. Whi
    11·2 answers
  • CJ is developing a new website blogging about cutting-edge technologies for people with special needs. He wants to make the site
    8·1 answer
  • Where is a 3D modeler most likely to work?
    6·1 answer
  • The domain name service (dns is a distributed database that allows users to communicate with each other computers by:
    7·1 answer
  • Which of the following payment types require you to pay upfront?
    9·1 answer
  • What do you think color theory<br> in web design is?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!