Trying to fix this code so I can compile it in VS2012, not seeing whats not work
ID: 3663885 • Letter: T
Question
Trying to fix this code so I can compile it in VS2012, not seeing whats not working need an assist
// ConsoleApplication2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <string.h>
#include <iostream>
#include <new>
using namespace std;
class student{
public:
string name;
string address;
string ID;
student(string n,string add,string id){
name = n;
address = add;
ID = id;
}
void setName(string n){
name = n;
}
void setAddress(string a){
address = a;
}
void setID(string id){
ID = id;
}
string getName(){
return name;
}
string getAddress(){
return address;
}
string getID(){
return ID;
}
string ShowMe(){
return "---- STUDENT INFORMATION ---- NAME : "+name+" ADDRESS : "+address+" ID : "+ID+" ";
}
};
class course{
public:
string title;
string cr_ID;
string instructor;
course(string t,string id,string instr){
title = t;
cr_ID = id;
instructor = instr;
}
void setTitle(string t){
title = t;
}
void setID(string cr){
cr_ID = cr;
}
void setInstructor(string ins){
instructor = ins;
}
string getTitle(){
return title;
}
string getID(){
return cr_ID;
}
string getInstructor(){
return instructor;
}
string ShowMe(){
return "---- COURSE INFORMATION ---- TITLE : "+title+" COURSE ID : "+cr_ID+" INSTRUCTOR : "+instructor+" ";
}
};
int main(){
student* std = new student("VIJENDER","IIT DELHI","2012CS10262");
cout << std->ShowMe() << endl;
course c("DATA STRUCTURE AND ALGORITHM","CSL201","AMIT KUMAR");
cout << c.ShowMe() << endl;
return 0;
}
Explanation / Answer
---- STUDENT INFORMATION ----
NAME : VIJENDER
ADDRESS : IIT DELHI
ID : 2012CS10262
---- COURSE INFORMATION ----
TITLE : DATA STRUCTURE AND ALGORITHM
COURSE ID : CSL201
INSTRUCTOR : AMIT KUMAR