Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
|
|
@ -0,0 +1,34 @@
|
|||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
class Demonstration {
|
||||
public:
|
||||
Demonstration() {
|
||||
variables = { };
|
||||
}
|
||||
|
||||
std::map<std::string, double> variables;
|
||||
};
|
||||
|
||||
int main() {
|
||||
Demonstration demo;
|
||||
std::cout << "Create two variables at runtime:" << std::endl;
|
||||
for ( uint32_t i = 1; i <= 2; ++i ) {
|
||||
std::cout << " Variable number " << i << ":" << std::endl;
|
||||
std::cout << " Enter name: " << std::endl;
|
||||
std::string name;
|
||||
std::cin >> name;
|
||||
std::cout << " Enter value: " << std::endl;
|
||||
double value;
|
||||
std::cin >> value;
|
||||
demo.variables[name] = value;
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
std::cout << "Two new runtime variables appear to have been created." << std::endl;
|
||||
for ( const auto &[key, value] : demo.variables ) {
|
||||
std::cout << "Variable " << key << " = " << value << std::endl;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
type
|
||||
MyClass = class
|
||||
private
|
||||
dict := new Dictionary<string,object>;
|
||||
public
|
||||
procedure Add(name: string; value: object) := dict[name] := value;
|
||||
property Items[name: string]: object read dict[name]; default;
|
||||
end;
|
||||
|
||||
begin
|
||||
var obj := new MyClass;
|
||||
obj.Add('Name','PascalABC.NET');
|
||||
obj.Add('Age',16);
|
||||
Println(obj['Name'],obj['Age']);
|
||||
var obj1 := new MyClass;
|
||||
obj1.Add('X',2.3);
|
||||
obj1.Add('Y',3.8);
|
||||
Println(obj1['X'],obj1['Y']);
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue