Time of Update: 2015-05-11
標籤: #include<unistd.h>#include<sys/types.h>#include<pwd.h>#include<stdio.h>int main(int argc,char **argv){ pid_t my_pid,parent_pid; pid_t te ; my_pid=getpid(); parent_pid=getppid(); printf("mypid is [%d]\t
Time of Update: 2015-05-11
標籤:c++ 最大數 最小數 輸入 //輸入8個數,求出最大值與最小值#include <iostream>using namespace std;int max(int b[],int n),min(int b[],int n);int main(){int a[8];cout<<"輸入8個int型數 :";for(
Time of Update: 2015-05-11
標籤:c++ 字串 反向輸出 函數 <pre name="code" class="cpp">// 反向輸出字串#include<iostream>#include<string.h>using namespace std;void f(char p[]);int main(){
Time of Update: 2015-05-10
標籤:編輯器是使用環境turboc的IDE,使用dos視窗中的edit作為編輯器,有點類似於vim;使用的是xp-sp3的虛擬機器上的系統。Nisy說要有兩種語言,指令碼語言以及一個底層語言,比如現在我的python和正在學習的C。目前的狀態就是兩個都不精。講完C語言的學習模式以及編程的工作模式以及記憶體以及1+1的重要性後,開始使用edit編輯器學習文法,以及實現第一個程式1+1=?1、編輯測試檔案test.c圖1 dos視窗命令列第一行cd turboc2進入turboc2的C程式開發環境,
Time of Update: 2015-05-10
標籤:(1)如果C++程式中使用了帶尾碼".h"的標頭檔,那麼不必在程式中聲明命名空間,只需要檔案中包含標頭檔即可;(2)C++標準要求系統提供的標頭檔不帶尾碼".h",但為了表示C++與C的標頭檔既有聯絡又有區別,C++中所用標頭檔不帶尾碼".h",而是在C語言的相應標頭檔名之前加上首碼c:(3)自訂的標頭檔通常帶尾碼“.h",系統標準庫檔案不帶尾碼“.h"。(4)因為標準庫非常的龐大,所程式員在選擇的類的名稱或函數名時就很有可能和標準庫中的某個名字相同。所以為了避免這
Time of Update: 2015-05-10
標籤:#include "codechange.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <Windows.h>#include <locale.h>wchar_t *ANSITOUnicode(const char* str){ int textlen = 0;
Time of Update: 2015-05-10
標籤:主要的輸入輸出函數有6種:cin, cin.get() , cin.getline() ,getline() , gets() ,getchar()cin(1)根據變數的類型讀取資料結束條件:斷行符號鍵、空格鍵、TAB結束符的處理:緩衝區中丟棄使輸入結束的結束符(斷行符號鍵、空格鍵、TAB)#include <iostream>using namespace std;void main(){ int a,b; cin>>a>
Time of Update: 2015-05-10
標籤:C#支援通過多線程並行地執行代碼,一個線程有它獨立的執行路徑,能夠與其它的線程同時地運行。一個C#程式開始於一個單線程,這個單線程是被CLR和作業系統(也稱為“主線程”)自動建立的,並具有多線程建立額外的線程。這裡的一個簡單的例子及其輸出:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading;using
Time of Update: 2015-05-10
標籤:common Business-Oriented LanguageBASIC(Beginner‘s All-purpose Symbolic Instruction Code)1972 C1983 C++1995 Javaportability performanceObject-Oriented 功能文法子集subset;適用範圍sphere scope range of Applicationcompile 解釋parse explain機器指令 機器代碼 machine
Time of Update: 2015-05-10
標籤:【著作權聲明:尊重原創,轉載請保留出處:blog.csdn.net/shallnet,文章僅供學習交流,請勿用於商業用途】 其實在組合語言中也是可以使用C庫函數的,這一節我們來看一下如何在組合語言中調用C庫函數以使得我們的程式看上去很方便地和使用者互動。
Time of Update: 2015-05-10
標籤:unity3d 擴充函數 在日常使用Unity3d中,經常碰到一些簡單操作但是代碼卻很長的問題,比如變換一個 GameObject的 Y 位置,會按照下面的寫法:transform.localPosition = new Vector3 (transform.localPosition.x, transform.localPosition.y + 100,
Time of Update: 2015-05-10
標籤:使用C語言樣式的檔案操作函數,需要包含stdio.h標頭檔。1.開啟檔案的函數:1 //oflag的取值為“w”或“r”,分別表示以寫或讀的方式開啟2 FILE* fd = fopen(filename.c_str(), oflag);2.寫檔案的函數原型:size_t fwrite(const void* buffer, size_t size, size_t count, FILE* stream
Time of Update: 2015-05-11
標籤:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication4{ delegate T NumberChanger<T>(T n); class Program { static int num = 10; public static int AddNum(int p)
Time of Update: 2015-05-10
標籤:作用:協助我們初始化對像(給對像的每個屬性依次的賦值)建構函式是一個特殊的方法1、建構函式沒有傳回值,連void也不能寫2、建構函式名稱要和類名一樣3、建立對像時會執行建構函式4、建構函式可以重載類中預設有一個建構函式(隱藏的),如果你建立了一個建構函式,不管是有參數的,還是無參數的,他預設的那個無參數的建構函式都會消失,如果你需要無參的就要重新自已寫students 類using System;using System.Collections.Generic;using
Time of Update: 2015-05-10
標籤: 在這節C#課上,老師為我們講述了第22章資料流的相關內容。首先我們需要用到的類在System.IO的命名空間中。這些類包括了表示磁碟上某個檔案的File類,以及表示目錄的Directory類。 接下來我們就通過一些例子來體會一下:(一)、二進位輸入:using System;using System.IO;namespace ImplementingBinaryReadWriteToFile{ class Tester { const int
Time of Update: 2015-05-10
標籤: LINQ,Language-integrated Query (LINQ)(Language Integrated Query)是一組用於c#和Visual Basic語言的擴充。它允許編寫C#或者Visual Basic代碼以查詢資料庫相同的方式操作記憶體資料。類似於SQL。
Time of Update: 2015-05-10
標籤:繼承是C#的三大特性之一,它實現了多態性和代碼複用 1 class Program 2 { 3 static void Main(string[] args) 4 { 5 ChinesePerson c1 = new ChinesePerson(); 6 c1.name = "任家萱"; 7 c1.SayMyName(); 8 9
Time of Update: 2015-05-11
標籤:c++ 閏年 天數 函數 //判斷是否為閏年,是該年的哪一天#include <iostream>using namespace std;int sum(int month,int day);int leap(int year);int main(){int year,month,day;cout<<"請輸入一個日期: &
Time of Update: 2015-05-10
標籤: 1 //看EOF的值 2 3 #include <stdio.h> 4 #include <stdlib.h> 5 int main(void) 6 { 7 printf("EOF的值用數字表示為:%d\n", EOF); 8 system("pause"); 9 return 0;10 } 1 //驗證getchar()!= EOF的值 2 3 #include <stdio.h> 4 5 int main(void) 6 { 7
Time of Update: 2015-05-10
標籤:如果現在能夠組成1...x 的面值,加上一種 x+1 面值的紙幣,就能組成 1 ... x + C * (x + 1)的面值。因為如果面值是 k < (C+1)*(x + 1),我們可以用 k / (x + 1) 張 x+1 面值的紙幣,並用原來的紙幣組成 k % (x + 1),就得到了 k