c++builder吧 关注:706贴子:3,312
  • 18回复贴,共1

c++builder和delphi有什么区别

只看楼主收藏回复

怎么找不到c++builder的学习视频,看delphi的可以吗?


IP属地:湖南1楼2013-02-18 22:39回复
    视频教程不好找,你可以看国外网站,国内少。两个语言底层的基础框架一致,函数库什么都是Delphi写的,也就是VCL框架。一个是c++,一个是pascal语法。你搜索下ccrun


    IP属地:江苏来自Android客户端2楼2013-02-19 00:55
    收起回复

      //---------------------------------------------------------------------------
      #include <iostream.h>
      #include <condefs.h>
      #pragma hdrstop
      //---------------------------------------------------------------------------
      int main(int argc, char* argv[])
      {
      cout << "hello word" <<endl;
      // getch();
      return 0;
      }
      //---------
      这个是书上的
      下面是创建后file1.cpp原有的代码
      //---------------------------------------------------------------------------
      #include <vcl.h>
      #pragma hdrstop
      #include <tchar.h>
      //---------------------------------------------------------------------------
      #pragma argsused
      int _tmain(int argc, _TCHAR* argv[])
      {
      return 0;
      }
      //----------------


      IP属地:湖南3楼2013-02-20 10:45
      回复
        我在原来的file1.cpp上改成了书上的代码也一样能运行,不过得加conio.h
        两个代码都用的了,它为什么要把main,改成tmain? _TCHAR可能仅仅是用了宏定义吧?原来应该是char


        IP属地:湖南4楼2013-02-20 10:49
        收起回复
          2.还有个问题:既然是c++的语法为什么还用include<iostream.h> 而用include<iostream>就出错了了?而且书上有个练习题是iostream.h和stdio.h一起包含了


          IP属地:湖南5楼2013-02-20 15:26
          收起回复
            这程序运行出错: 开始报错: std::sqrt(float) std::sqrt(long double)
            //---------------------------------------------------------------------------
            #include <iostream.h>
            #include <conio.h>
            #include <math.h>
            #include <stdio.h>
            #pragma hdrstop
            #include <tchar.h>
            //---------------------------------------------------------------------------
            #pragma argsused
            void getSqrRoot(char *buff, int x);
            int _tmain(int argc, _TCHAR* argv[])
            {
            int x;
            char buff[30];
            cout << "Enter a number:";
            cin >> x;
            getSqrRoot(buff, x);
            cout << buff << endl;
            getch();
            return 0;
            } void getSqrRoot(char *buff, int x)
            {
            sprintf(buff, "The squar root is %f", sqrt(x));
            }
            //---------------------------------------------------------------------------
            我开始以为是空间名using namespace std的问题。。。后来把x参数都int改成float型就好了
            :我主要是想知道书上是c++builder6编译的能够运行吗?还是书上的习题错了?
            :而且<stdio.h>也可有可无。。。
            这些个东西怎么回事,sqrt()的传入参数不能自动转float吗?
            //--------------------------------------------------------------------------- #include <iostream.h>
            #include <conio.h>
            #include <math.h>
            //#include <stdio.h> #pragma hdrstop #include <tchar.h>
            //--------------------------------------------------------------------------- #pragma argsused
            void getSqrRoot(char *buff, float x);
            int _tmain(int argc, _TCHAR* argv[])
            {
            float x;
            char buff[30];
            cout << "Enter a number:";
            cin >> x;
            getSqrRoot(buff, x);
            cout << buff << endl;
            getch();
            return 0;
            } void getSqrRoot(char *buff, float x)
            {
            sprintf(buff, "The squar root is %f", sqrt(x));
            }
            //---------------------------------------------------------------------------


            IP属地:湖南6楼2013-02-20 16:11
            回复