Информационные технологииStfw.Ru 🔍

Что лудше Delphi или C ? [компьютеры] Закрытые

admin
🕛 25.05.2010, 17:17
qweqweqwe.. ::Можноли что то написать на Delphi чего нельзя написать на C ?Или же на оборот что то на C что нельзя на Delphi ? #.. ::На пример: На Delphi можно написать игру, которую можно написать на C ?mutant.. ::Все что можно написать на одном языке, можно написать и на другомВопрос где это сделать проще и быстрее.Blacklokky.. ::Эволюция программиста:High School/Jr.High=================== PRINT "HELLO WORLD" END=====================First year in College=====================program Helloinput, outputbeginwritelnHello World;end.======================Senior year in College======================defun helloprintcons Hello list World================New professional================#includevoid mainvoid{char *message[] = {"Hello ", "World"};int i;fori = ; i < ; ++iprintf"%s", message;printf" ";}====================Seasoned professional=====================#include#includeclass string{private:int size;char *ptr;public:string : size, ptrnew char {}stringconst string &s : sizes.size{ptr = new char[size + 1];strcpyptr, s.ptr;}~string{delete [] ptr;}friend ostream &operator <<ostream &, const string &;string &operator=const char *;};ostream &operator<<ostream &stream, const string &s{returnstream << s.ptr;}string &string::operator=const char *chrs{if this != &chrs{delete [] ptr;size = strlenchrs;ptr = new char[size + 1];strcpyptr, chrs;}return*this;}int main{string str;str = "Hello World";cout << str << endl;return;}=================Master Programmer=================[uuidFF-CFEE-A-AF-AA]library LHello{// bring in the master libraryimportlib"actimp.tlb";importlib"actexp.tlb";// bring in my interfaces#include "pshlo.idl"[uuidFF-CFEE-A-AF-AA]cotype THello{interface IHello;interface IPersistFile;};};[exe,uuidF-CFEE-A-AF-AA]module CHelloLib{// some code related header filesimportheader#include#include#include#include "thlo.h"#include "pshlo.h"#include "shlo.hxx"#include "mycls.hxx"int CHello:cObjRef = ;CHello::CHelloIUnknown *pUnk : CHelloBasepUnk{cObjRef++;return;}HRESULT _stdcall CHello::PrintSzLPWSTR pwszString{printf"%ws ", pwszString;returnResultFromScodeS_OK;}CHello::~CHellovoid{// when the object count goes to zero, stop the servercObjRef-;if cObjRef == PulseEventhEvent;return;}#include#include#include "pshlo.h"#include "shlo.hxx"#include "mycls.hxx"HANDLE hEvent;int _cdecl mainint argc,char * argv[] {ULONG ulRef;DWORD dwRegistration;CHelloCF *pCF = new CHelloCF;hEvent = CreateEventNULL, FALSE, FALSE, NULL;// Initialize the OLE librariesCoInitiali, NULL;// Initialize the OLE librariesCoInitializeExNULL, COINIT_MULTITHREADED;CoRegisterClassObjectCLSID_CHello, pCF, CLSCTX_LOCAL_SERVER,REGCLS_MULTIPLEUSE, &dwRegistration;// wait on an event to stopWaitForSingleObjecthEvent, INFINITE;// revoke and release the class objectCoRevokeClassObjectdwRegistration;ulRef = pCF->Release;// Tell OLE we are going away.CoUninitialize;return; }extern CLSID CLSID_CHello;extern UUID LIBID_CHelloLib;CLSID CLSID_CHello = { /* F-CFEE-A-AF-AA */xF,xCFEE,xA,{ xA, xF, x, xAA, x, x, x, x }};UUID LIBID_CHelloLib = { /* F-CFEE-A-AF-AA */xF,xCFEE,xA,{ xA, xF, x, xAA, x, x, x, x }};#include#include#include#include#include#include "pshlo.h"#include "shlo.hxx"#include "clsid.h"int _cdecl mainint argc,char * argv[] {HRESULT hRslt;IHello *pHello;ULONG ulCnt;IMoniker * pmk;WCHAR wcsT[_MAX_PATH];WCHAR wcsPath[2 * _MAX_PATH];// get object pathwcsPath[0] = ;wcsT[0] = ;if argc {mbstowcswcsPath, argv[1], strlenargv[1] + ;wcsuprwcsPath;}else {fprintfstderr, "Object path must be specified ";return;}// get print stringifargc mbstowcswcsT, argv[2], strlenargv[2] + ;elsewcscpywcsT, L"Hello World";printf"Linking to object %ws ", wcsPath;printf"Text String %ws ", wcsT;// Initialize the OLE librarieshRslt = CoInitializeExNULL, COINIT_MULTITHREADED;ifSUCCEEDEDhRslt {hRslt = CreateFileMonikerwcsPath, &pmk;ifSUCCEEDEDhRslthRslt = BindMonikerpmk, , IID_IHello, void **&pHello;ifSUCCEEDEDhRslt {// print a string outpHello->PrintSzwcsT;Sleep;ulCnt = pHello->Release;}elseprintf"Failure to connect, status: %lx", hRslt;// Tell OLE we are going away.CoUninitialize;}return;}=================Apprentice Hacker=================#!/usr/local/bin/perl$msg="Hello, world. ";if $#ARGV >= whiledefined$arg=shift@ARGV$outfilename = $arg;openFILE, ">" . $outfilename || die "Cant write $arg: $! ";print FILE $msg;closeFILE || die "Cant close $arg: $! ";}} else {print $msg;};==================Experienced Hacker==================#include#define S "Hello, World "main{exitprintfS == strlenS ? : ;}===============Seasoned Hacker===============% cc -o a.out ~/src/misc/hw/hw.c% a.out===========Guru Hacker===========% catHello, world.^D=====================AXE System programmer=====================LL:.seg "data".seg "text".proc .global _main_main:!#PROLOGUE# sethi %hiLF,%gadd %g,%loLF,%gsave %sp,%g,%sp!#PROLOGUE# .seg "data"L:.ascii "Hello, World ".seg "text".seg "data"L:.ascii "Hello, World ".seg "text"set L,%ocall _strlen,nopmov %o,%iset L,%ocall _printf,nopcmp %o,%ibne Lnopmov ,%ob LnopL:mov x,%oL:call _exit,nopLE:retrestoreLF = -LP = LST = LT = .seg "data" f ffff a de ba ba a d c e e cc fc f c a cc fc f c a c e b e ffff ffec b ffff ffd c ffff ffb a a fd e f e f c e f % axe_generate -f system.uhdlApplication Exchange generated source code linesNo Errors detected.Hardware retrieval...done OKCertification Test...done OKPacking..done OKDelivery.done OKApplication Exchange delivered to customer bytes/sec.End processing, seconds.===========================Ultra high level programmer===========================system.uhdl :SYSTEMCREATE ScreenWinSIZE 0/Unit=OneDESTINATION Order.dest[One]OUTPUT CHARACTER[Hello world]ENDEND===========New Manager=========== PRINT "HELLO WORLD" END==============Middle Manager==============mail -s "Hello, world." bob@bBob, could you please write me a program that prints"Hello, world."? I need it by tomorrow.^D==============Senior Manager==============% zmail allI need a "Hello, world." program by this afternoon.===============Chief Executive===============% messagemessage: Command not found% pmpm: Command not found% letterletter: Command not found.% mailTo: ^X ^F ^C> help mailhelp: Command not found.>whatwhat: Command not found>need helpneed: Command not found> damn!!: Event unrecognized>exitexit: Unknown>quit%% logoutOCTAGRAM.. ::C -> Delphi можно. Delphi уходит корнями в Паскаль, а Паскаль и C разделяют много общего.Delphi -> C можно, но некоторые фичи исключения, события, счётчики ссылок придётся реализовывать вручную. Грязная работа, надо сказать.

Вопросы и ответы   Теги:

Читать IT-новости в Telegram
Информационные технологии
Мы в соцсетях ✉