mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-06 14:52:03 +01:00
Updated wikipage CECIL - C to Eiffel. (Signed-off-by:alexk). git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2257 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
49 lines
1.5 KiB
Plaintext
49 lines
1.5 KiB
Plaintext
[[Property:modification_date|Fri, 07 Aug 2020 10:28:41 GMT]]
|
|
[[Property:publication_date|Fri, 07 Aug 2020 10:28:41 GMT]]
|
|
[[Property:title|CECIL - C to Eiffel]]
|
|
[[Property:weight|0]]
|
|
[[Property:uuid|c3b64ef2-28b2-920e-44fb-4cff2320c099]]
|
|
==array==
|
|
This example shows how to create an Eiffel array from an existing C array. After you have done the appropriate steps to compile the example, you will get a `cecil.exe` on windows, or `cecil` on Unix. Launch the program and you will be prompted for 10 integers that will be inserted in a C array, it will then initialize the Eiffel array and calls display from the MY_ARRAY class. A typical output will be:
|
|
<code lang="text">
|
|
$ ./cecil
|
|
Enter 10 integers:
|
|
Enter element 1: 1
|
|
Enter element 2: 2
|
|
Enter element 3: 3
|
|
Enter element 4: 4
|
|
Enter element 5: 5
|
|
Enter element 6: 6
|
|
Enter element 7: 7
|
|
Enter element 8: 8
|
|
Enter element 9: 9
|
|
Enter element 10: 10
|
|
|
|
Display an Eiffel Array:
|
|
@1 = 1
|
|
@2 = 2
|
|
@3 = 3
|
|
@4 = 4
|
|
@5 = 5
|
|
@6 = 6
|
|
@7 = 7
|
|
@8 = 8
|
|
@9 = 9
|
|
@10 = 10
|
|
</code>
|
|
|
|
==string==
|
|
This example shows how to create an Eiffel string from an existing C string. After you have done the appropriate steps to compile the example, you will get a `cecil.exe` on windows, or `cecil` on Unix. Launch the program and you will be prompted for a string, it will then initialize the Eiffel string and calls io. put_string from the STD_FILES class. A typical output will be:
|
|
<code lang="text">
|
|
$ ./cecil
|
|
Enter a string to convert in Eiffel string:
|
|
Hello World!
|
|
Now printing the Eiffel string from Eiffel
|
|
|
|
Hello World!
|
|
</code>
|
|
|
|
|
|
|
|
|