I'm studying object arrangement. I don't know why the consonants and vowels of the entered values are separated and printed. Like this.
Name: ㅣㅁㄱ Age: 2 Class number: 0 Name: ㅣㅁㄱ Age: 3 Class number: 1 Name: ㅣㅇ Age: 3 Class number: 2 Name: ㅏㄱ 이름 Age: 4 Class number: 3 Name: ㅗㅣㅊ Age: 5 Class number: 4
Below is the code for reference.
#include <iostream>
using namespace std;
class Student {
private:
char name[10];
int age;
int studentID;
public:
Student() { cout << "Call creator!" << endl;}
void SetInfo(char * _name, int _age, int _studentID) {
strcpy(name, _name);
age = _age;
studentID = _studentID;
}
void GetInfo() {
cout << "Name: " << name << endl;
cout << "Age:" <<age << endl;
cout << "Class: << student ID << endl;
}
~Student() { cout <<"Call the Extinction!" <<endl;}
};
int main() {
Student student[5];
char name[10];
int age, studentID;
for(int i=0; i<5; i++) {
cin >> name >> age >> studentID;
student[i].SetInfo(name, age, studentID);
}
for(int i=0; i<5; i++)
student[i].GetInfo();
}
This is a Unicode issue. At the beginning of the main function,
setlocale(LC_ALL, "");
Put it in and do it.
As far as I know, they set the language according to the current area.
For your information, it works well on Mac.
© 2024 OneMinuteCode. All rights reserved.