This commit is contained in:
RafayAhmad7548 2024-06-16 18:53:25 +05:00
parent 37776af5db
commit ab03d5f10c
4045 changed files with 286212 additions and 3 deletions

View file

@ -0,0 +1,47 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student *students;
public:
Course(string name, int code) : name(name), code(code){
students = new Student[2];
}
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,28 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Course{
};
struct Student{
string name;
int rollNo;
Course *courses;
};
int main(){
return 0;
}

View file

@ -0,0 +1,27 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Course{
};
struct Student{
string name;
int rollNo;
Course *courses;
};
int main(){
return 0;
}

View file

@ -0,0 +1,35 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Course{
};
struct Student{
string name;
int rollNo;
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,40 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Course{
string name;
string code;
Student s1, s2;
public:
};
struct Student{
string name;
int rollNo;
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,58 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student **students;
int i;
public:
Course(string name, int code) : name(name), code(code), i(0){
students = new Student*[2];
}
void enrollStudent(Student *s){
students[i] = s;
i++;
}
friend ostream& operator<<(ostream& out, Course& course);
};
ostream& operator<<(ostream& out, Course& course){
out<<"Course name: "<<course.name<<endl;
out<<"Course code: "<<course.code<<endl;
}
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,22 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Course{
};
struct Student{
string name;
int rollNo;
};
int main(){
return 0;
}

View file

@ -0,0 +1,57 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student **students;
int i;
public:
Course(string name, int code) : name(name), code(code), i(0){
students = new Student*[2];
}
void enrollStudent(Student *s){
students[i] = s;
i++;
}
friend ostream& operator<<(ostream& out, Course& course);
};
ostream& operator<<(ostream& out, Course& course){
out<<"Course name: "<<course.name<<endl;
}
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,13 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
int main(){
return 0;
}

View file

@ -0,0 +1,53 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student *students;
int i;
public:
Course(string name, int code) : name(name), code(code), i(0){
students = new Student[2];
}
void enrollStudent(Student *s){
students[i] = *s;
}
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,53 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student **students;
int i;
public:
Course(string name, int code) : name(name), code(code), i(0){
students = new Student*[2];
}
void enrollStudent(Student *s){
students[i] = s;
i++;
}
friend ostream& operator<<(ostream& out, Student& student);
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,57 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student **students;
int i;
public:
Course(string name, int code) : name(name), code(code), i(0){
students = new Student*[2];
}
void enrollStudent(Student *s){
students[i] = s;
i++;
}
friend ostream& operator<<(ostream& out, Student& student);
};
ostream& operator<<(ostream& out, Student& student){
}
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,64 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student **students;
int i;
public:
Course(string name, int code) : name(name), code(code), i(0){
students = new Student*[2];
}
void enrollStudent(Student *s){
students[i] = s;
i++;
}
friend ostream& operator<<(ostream& out, Course& course);
};
ostream& operator<<(ostream& out, Course& course){
out<<"Course name: "<<course.name<<endl;
out<<"Course code: "<<course.code<<endl;
for(int i=0;i<course.i;i++){
out<<"Student "<<i<<endl;
out<<"name: "<<course.students[i]->name<<endl;
out<<"rollno: "<<course.students[i]->rollNo<<endl;
}
return out;
}
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,54 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student **students;
int i;
public:
Course(string name, int code) : name(name), code(code), i(0){
students = new Student*[2];
}
void enrollStudent(Student *s){
students[i] = s;
i++;
}
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,63 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student **students;
int i;
public:
Course(string name, int code) : name(name), code(code), i(0){
students = new Student*[2];
}
void enrollStudent(Student *s){
students[i] = s;
i++;
}
friend ostream& operator<<(ostream& out, Course& course);
};
ostream& operator<<(ostream& out, Course& course){
out<<"Course name: "<<course.name<<endl;
out<<"Course code: "<<course.code<<endl;
for(int i=0;i<course.i;i++){
out<<"Student "<<i<<endl;
out<<"name: "<<course.students[i]->name<<endl;
out<<"rollno: "<<course.students[i]->rollNo<<endl;
}
}
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,48 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student *students;
public:
Course(string name, int code) : name(name), code(code){
students = new Student[2];
}
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,44 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Course{
string name;
string code;
Student *students;
public:
};
struct Student{
string name;
int rollNo;
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,56 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student **students;
int i;
public:
Course(string name, int code) : name(name), code(code), i(0){
students = new Student*[2];
}
void enrollStudent(Student *s){
students[i] = s;
i++;
}
friend ostream& operator<<(ostream& out, Student& s);
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1 @@
{"version":1,"resource":"file:///home/rafayahmad/Stuff/OOP/lab13/q2.cpp","entries":[{"id":"Ni9w.cpp","timestamp":1714362393145},{"id":"4lR7.cpp","timestamp":1714366520389},{"id":"8xKB.cpp","timestamp":1714366544556},{"id":"MiT2.cpp","timestamp":1714366558323},{"id":"uWno.cpp","timestamp":1714366713497},{"id":"FO31.cpp","timestamp":1714366752618},{"id":"rzDw.cpp","timestamp":1714366792229},{"id":"JDVx.cpp","timestamp":1714366811477},{"id":"ay4A.cpp","timestamp":1714366828234},{"id":"laeB.cpp","timestamp":1714366868551},{"id":"luCp.cpp","timestamp":1714366882979},{"id":"0gZG.cpp","timestamp":1714366924306},{"id":"YAqG.cpp","timestamp":1714366937670},{"id":"wHxh.cpp","timestamp":1714366967724},{"id":"rtll.cpp","timestamp":1714366984251},{"id":"OQdA.cpp","timestamp":1714367009582},{"id":"ScjE.cpp","timestamp":1714367039926},{"id":"d3iJ.cpp","timestamp":1714367118832},{"id":"OqG0.cpp","timestamp":1714367130065},{"id":"PGGx.cpp","timestamp":1714367142572},{"id":"jRaR.cpp","timestamp":1714367164286},{"id":"Mutr.cpp","timestamp":1714367190430},{"id":"LQLL.cpp","timestamp":1714367205252},{"id":"vK7M.cpp","timestamp":1714367264154},{"id":"WJbU.cpp","timestamp":1714367292109},{"id":"RVPf.cpp","timestamp":1714367311944}]}

View file

@ -0,0 +1,57 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student **students;
int i;
public:
Course(string name, int code) : name(name), code(code), i(0){
students = new Student*[2];
}
void enrollStudent(Student *s){
students[i] = s;
i++;
}
friend ostream& operator<<(ostream& out, Course& course);
};
ostream& operator<<(ostream& out, Course& course){
}
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,46 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Course{
string name;
int code;
Student *students;
public:
Course(string name, int code) : name(name), code(code){
}
};
struct Student{
string name;
int rollNo;
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,47 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student *students;
public:
Course(string name, int code) : name(name), code(code){
}
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,53 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student *students;
int i;
public:
Course(string name, int code) : name(name), code(code), i(0){
students = new Student[2];
}
void enrollStudent(Student *s){
}
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,35 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Course{
Student s1, s2;
};
struct Student{
string name;
int rollNo;
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,32 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
class Course{
struct Student{
string name;
int rollNo;
};
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,62 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student **students;
int i;
public:
Course(string name, int code) : name(name), code(code), i(0){
students = new Student*[2];
}
void enrollStudent(Student *s){
students[i] = s;
i++;
}
friend ostream& operator<<(ostream& out, Course& course);
};
ostream& operator<<(ostream& out, Course& course){
out<<"Course name: "<<course.name<<endl;
out<<"Course code: "<<course.code<<endl;
for(int i=0;i<course.i;i++){
out<<"Student "<<i<<endl;
out<<course.students[i]->name<<endl;
}
}
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}

View file

@ -0,0 +1,52 @@
/*
Rafay Ahmad
23I-2526
*/
#include <iostream>
using namespace std;
struct Student{
string name;
int rollNo;
Student(){}
Student(string name, int rollNo) : name(name), rollNo(rollNo){}
};
class Course{
string name;
int code;
Student *students;
public:
Course(string name, int code) : name(name), code(code){
students = new Student[2];
}
void enrollStudent(Student *s){
}
};
int main() {
Student student1("Shahood", 1001);
Student student2("Hammad", 1002);
Student student3("Ali", 1003);
Course course1("Math", 2001);
Course course2("Physics", 2002);
course1.enrollStudent(&student1);
course1.enrollStudent(&student2);
course2.enrollStudent(&student2);
course2.enrollStudent(&student3);
cout << course1 << endl;
cout << course1 << endl;
return 0;
}