From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,df854b5838c3e14 X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,df854b5838c3e14 X-Google-Attributes: gid1014db,public X-Google-Thread: 109fba,df854b5838c3e14 X-Google-Attributes: gid109fba,public From: jsa@organon.com (Jon S Anthony) Subject: Re: C/C++ knocks the crap out of Ada Date: 1996/02/20 Message-ID: #1/1 X-Deja-AN: 140154353 sender: news@organon.com (news) references: <00001a73+00002504@msn.com> <4etcmm$lpd@nova.dimensional.com> organization: Organon Motives, Inc. newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++ Date: 1996-02-20T00:00:00+00:00 List-Id: In article <4g966j$cr8@goanna.cs.rmit.EDU.AU> ok@goanna.cs.rmit.EDU.AU (Richard A. O'Keefe) writes: > Simple I/O: > > Step 1 > Look it up in the manual > Step 2 > Do what the Fine Manual says. > > *SIMPLE* I/O involves withing and using a couple of standard packages, > and then using Put, New_Line, Get, and Skip_Line. Pretty darned simple. > It has not been a problem for first-year students at this university. > > Ada does not support Fortran-style formatted I/O, nor PL/I style > formatted or pictured I/O (but see Interfaces.COBOL). For most naive (first time users) needs it is even simpler than this. Here, again, is a version in C and Ada of a simple first program: First, the Ada (14 lines): with Ada.Command_Line; use Ada.Command_Line; with Text_Io; use Text_Io; procedure X is begin Put_Line( "My name is " & Command_Name & ", I have" & Integer'Image(Argument_Count) & " arguments."); Put_Line("They are: "); for I in 1..Argument_Count loop Put_Line(" " & Argument(I)); end loop; end; $ gnatmake $tests_wrk/x.adb $ x 1 2 3 My name is x, I have 3 arguments. They are: 1 2 3 Now the C (14 lines): #include main (argc, argv) int argc; char *argv[]; { int i; printf ("My name is %s, I have %d arguments \n", argv[0], argc-1); printf ("They are: \n"); for (i = 1; i < argc; i++) printf(" %s\n", argv[i]); } $ gcc -o cx cx.c $ cx 1 2 3 My name is cx, I have 3 arguments They are: 1 2 3 /Jon -- Jon Anthony Organon Motives, Inc. 1 Williston Road, Suite 4 Belmont, MA 02178 617.484.3383 jsa@organon.com