#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
 
struct student
{
    char* name;
    char* subject;
    int mark;
};
 
void LineToStudent(student *Student, std::string &line)
{
    std::istringstream iss(line);
    std::string word;
    
    iss >> word;
    Student->name = new char[word.length()+1];
    strcpy(Student->name, word.c_str());
 
    iss >> word;
    Student->subject = new char[word.length() + 1];
    strcpy(Student->subject, word.c_str());
 
    iss >> Student->mark;
}
 
void ClearStudent(student *Student)
{
    delete [] Student->name;
    delete[] Student->subject;
    delete Student;
}
 
int main()
{
    std::string line = "Vasya History 2";
 
    student *Student = new student;
    LineToStudent(Student, line);
 
    std::cout << "Name: " << Student->name << "\nSubject: " << Student->subject << "\nMark: " << Student->mark;
 
    std::cin.get();
    ClearStudent(Student);
    return 0;
}