ACM常用基礎 二 常用函式

2021-05-22 03:00:37 字數 1991 閱讀 1152

string char length();

int_64

輸入輸出

__int 64

轉化成string

stl

字典序

c/c++

申請多維陣列

qsort(arr,n,sizeof(int),compare);//c

語言排序

三階矩陣相乘

十六進製制轉換為2進製

string char length()

string str a=str.length();

getline(cin

,str)

char str1[128],str2[4508]

cin.getline(str1,128);

cin.getline(str2,4508);

a=strlen(str1);

b=strlen(str2);

int_64

輸入輸出

scanf("%i64d",&a);

printf("%i64d",a);

__int 64

轉化成string

1.sstream

2.sprintf

3._i64toa

4.char *_i64toa

#include

#include

#include

using

namespace

std;

intmain()

1.c ++

動態建立多維陣列

char *a=new char[10];

delect [ ] a

;//[ ]

表示對陣列空間的操作

正確的做法是先宣告乙個

n維陣列,每個單元是指向

char

的指標,再分別對每個單元分配記憶體

.**如下

char **array=new char*[n];

for(int i=0;i

array[i]=new char[n];

注意:上面**在釋放分配的記憶體時要特別注意。因為這是

「深度記憶體分配

」,所以釋放時,要對每個單元裡的指標指向的記憶體予以釋放。釋放記憶體**如下:

for(i=0;i

delete array[i];

delete array; 一維

arr = (int *)malloc(sizeof(int)*n);

多維char **p;

p = (char **)malloc(sizeof(char *) * n);

for(i = 0; i < n; i++)

p[i] = (char *)malloc(sizeof(char) * m);

釋放:for(i = 0; i < n; i++)

free(p[i]);

free(p);

c語言排序

#include "stdio.h"

#include

int compare (const void * a, const void * b)

void main()

三階矩陣相乘

for(i=0;i<3;i++;)

} }

十六進製制轉換為2進製

/* strtol example     strtol("df",   null,   16);這樣用*/

#include

#include

int main ()

/* itoa example */

#include

#include

int main ()

output:

enter a number: 1750

decimal: 1750

hexadecimal: 6d6

binary: 11011010110

ACM常用數學公式 基礎版

在做題時候經常遇到一些初高中的數學題,這時候如果想不起來公式真的太尷尬了,於是在自閉之後決定把這些簡單的幾何裡的數學公式彙總一下。弧長公式 l r 弧度制 扇形面積公式 s 1 2lr 1 2 r 2 s n 360 r 2 sinx,cosx 函式的含義就不解釋了 這裡說一下c三角函式的使用 標頭...

Oracle 常用基礎函式

abs函式 取n的絕對值。concat函式 字串拼接,與 效果相同。initcap函式 將單詞的首字母以大寫的方式返回,其他小寫。單詞由空格 控制字元 標點符號限制 instr 函式 查詢l字元,首個l位於第3個位置。length lengthb函式 length 返回字串的長度 lengthb 返...

Nginx 二 常用基礎

檢視nginx程序狀態 ps ef grep nginx 進入 nginx 目錄中 cd usr local nginx sbin 1 檢視 nginx 版本號 nginx v 2 啟動 nginx nginx 3 停止 nginx nginx s stop 1 nginx 配置檔案位置 cd us...