Test program and notes for a C/C++ struct example.

This commit is contained in:
Ernie Pasveer
2022-08-04 19:51:15 -05:00
parent 87bdd2e59a
commit c75593e9a1
5 changed files with 95 additions and 0 deletions
+26
View File
@@ -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;
}