New Some File
This commit is contained in:
parent
3ea952c33b
commit
ca60fd748e
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"cmake.configureOnOpen": false
|
||||
}
|
2
src/type/ptr/Advanced/ptr_functrion.cpp
Normal file
2
src/type/ptr/Advanced/ptr_functrion.cpp
Normal file
@ -0,0 +1,2 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
20
src/type/ptr/Advanced/ptr_struct.cpp
Normal file
20
src/type/ptr/Advanced/ptr_struct.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include <cstdio>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
struct student {
|
||||
char name[20];
|
||||
char sex;
|
||||
int score;
|
||||
} studentList[3] = {{"SB1", 'F', 239}, {"SB2", 'F', 232}, {"SB3", 'M', 832}};
|
||||
int main() {
|
||||
student *ptr;
|
||||
cout << setw(9) << "Name "
|
||||
<< "Sex "
|
||||
<< "Score " << endl;
|
||||
for (ptr = studentList; ptr < studentList + 3; ptr++) {
|
||||
cout << setw(9) << ptr->name << " " << setw(1) << ptr->sex << " "
|
||||
<< setw(3) << ptr->score << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
BIN
src/type/ptr/Advanced/struct
Executable file
BIN
src/type/ptr/Advanced/struct
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user