推介:| 網頁寄存 | 網頁設計 | 開網店 | 電郵申請 | Wordpress Hosting | 外賣平台 | 英語課程推薦 | 風水屋 | 房間風水懷孕 | Timway Testimonial | Wedding Planner | Wedding MC |

發新話題
打印

開始撰寫C++程式的問題

開始撰寫C++程式的問題

想請問一下interpreter與compiler有何不同, 兩者之間有何優點和缺點, 以及portability是什麼意思??

TOP

然則, 又如何定義有關ANSI/ISO C++的標準??

TOP

在C++中, 如何去分辨出何謂語法錯誤(syntax error), 何謂語意錯誤(semantic error)??

TOP

如果我想將n1, n2宣告成整數型態變數, 宣告完成以後, 再將n1設值為6, n2設值為8, 最後將n1, n2的值印出, 而我所撰寫的程式究竟出了什麼問題??
#include<iostream>
#include<cstdlib>
using namespace std;
int main(void)
{
    int n1, n2;
    char ch;
    n1=6;
    n2=8;
    ch='w';
    cout << "n1" << + << "n2" << = << n1+n2= << endl;
    system("pause");
    return 0;
}

最主要的是出了什麼問題!!

TOP

以下這程式在實際經驗有何用處以及有沒有必要背熟??
// prog3_2.cpp, 印出各種資料型態的長度
#include<iostream>
#include<cstdlib>
using namespace std;
int main(void)
{
    //定義各種資料型態的變數
    unsigned int i=0;
    unsigned short int j=0;
    char ch=' ';
    float f=0.0f;
    double d=0.0;
   
    //印出各種資料型態的長度
    cout << "sizeof(int)=" << sizeof(int) << endl;
    cout << "sizeof(long int)=" << sizeof(long int) << endl;
    cout << "sizeof(unsigned int)=" << sizeof(i) << endl;
    cout << "sizeof(short int)=" << sizeof(short int) << endl;
    cout << "sizeof(unsigned short int)=" << sizeof(j) << endl;
    cout << "sizeof(char)=" << sizeof(ch) << endl;
    cout << "sizeof(float)=" << sizeof(f) << endl;
    cout << "sizeof(double)=" << sizeof(d) << endl;
    cout << "sizeof(bool)=" << sizeof(bool) << endl;
    system("pause");
    return 0;
}

TOP

這是一個整數資料型態的溢位, 究竟何謂溢位?
// prog3_3.cpp, 整數資料型態的溢位
#include<iostream>
#include<cstdlib>
using namespace std;
int main(void)
{
    int i=2147483647;       // 宣告i為整數, 並設值為2147483647
   
     cout << "i=" << i << endl;  // 印出i 的值
     cout << "i+1=" << i+1 << endl;  // 印出i+1的值
     cout << "i+2=" << i+2 << endl;  // 印出i+2的值
     system("pause");
     return 0;
}

TOP

如果以ASCII碼中, 英語小寫a-z是不是代表不同的數字?? 以h為例, 是不是就是以104來作為代表??
同時, 有關二進位, 十進位的轉換是如何計算的呢??

[ 本帖最後由 花之慶次 於 2007-4-3 23:55 編輯 ]

TOP

有些奇怪

// prog1_1.cpp.cpp : 定義主控台應用程式的進入點。
//

#include "stdafx.h"
#include<iostream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])

{
        cout << "Hello!!我是陳大文, 你好" << endl;
        system("pause");
        return 0;
}

執行如下:
'prog1_1.cpp.exe': 已載入 'C:\Documents and Settings\Mau hung Li\My Documents\Visual Studio 2005\Projects\prog1_1.cpp\Debug\prog1_1.cpp.exe',已載入符號
'prog1_1.cpp.exe': 已載入 'C:\WINDOWS\system32\ntdll.dll',未載入符號
'prog1_1.cpp.exe': 已載入 'C:\WINDOWS\system32\kernel32.dll',未載入符號
偵錯工具:: 處理序載入期間,發生未處理的非持續性 STATUS_DLL_NOT_FOUND 例外狀況
'[284] prog1_1.cpp.exe: 原生' 程式以返回碼 -1073741515 (0xc0000135) 結束。


為什麼會這樣??

TOP

發新話題


重要聲明:本討論區是以即時上載留言的方式運作,本網站對所有留言的真實性、完整性及立場等,不負任何法律責任。而一切留言之言論只代表留言者個人意見,並非本網站之立場,用戶不應信賴內容,並應自行判斷內容之真實性。於有關情形下,用戶應尋求專業意見(如涉及醫療、法律或投資等問題)。由於本討論區受到「即時上載留言」運作方式所規限,故不能完全監察所有留言,若讀者發現有留言出現問題,請聯絡我們。本討論區有權刪除任何留言及拒絕任何人士上載留言,同時亦有不刪除留言的權利。切勿撰寫粗言穢語、誹謗、渲染色情暴力或人身攻擊的言論,敬請自律。本網站保留一切法律權利。


Copyright 1997- Xocat. All Right Reserved.