mirror of
https://github.com/epasveer/seer.git
synced 2026-08-31 01:20:45 +08:00
Test program and notes for a C/C++ struct example.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
|
||||
struct Person {
|
||||
char name[50];
|
||||
std::string city;
|
||||
int age;
|
||||
float salary;
|
||||
};
|
||||
|
||||
|
||||
int main (int argc, char** argv) {
|
||||
|
||||
Person me;
|
||||
|
||||
strcpy(me.name, "Ernie Pasveer");
|
||||
me.city = "Houston";
|
||||
me.age = 60;
|
||||
me.salary = 0.25;
|
||||
|
||||
std::cout << "'" << me.name << "', from '" << me.city << "', is " << me.age << " years old and makes " << me.salary << " per year." << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user