[ create a new paste ] login | about

Link: http://codepad.org/YPDNSlLa    [ raw code | output | fork ]

C++, pasted on Dec 12:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define STACKLENGTH 10 // スタックサイズを10 とする
int stack[STACKLENGTH]; // スタック
int stack_p = 0; // スタックポインタ
int Pop(void);
void Push(int);
/*
**
逆ポーランド記法を用いたHex の計算
* 使用例rpn 1 2 +
* 使える演算子+、-、/、*、ˆ
*
*/
int main(int argc, char** argv)
{
int v;
sscanf(argv[1], "%x", &v); // 1番目の数を読み取る
Push(v);
sscanf(argv[2], "%x", &v); // 2番目の数を読み取る
Push(v);
switch(argv[3][0]){
// ここを作成する
}
printf("0x%x, %d\n", stack[0], stack[0]);
return 0;
}
void Push(int c)
{
// ここを作成する
}
int Pop()
{
// ここを作成する
}


Output:
1
2
3
4
5
6
cc1plus: warnings being treated as errors
In function 'int main(int, char**)':
Line 19: warning: format '%x' expects type 'unsigned int*', but argument 3 has type 'int*'
Line 21: warning: format '%x' expects type 'unsigned int*', but argument 3 has type 'int*'
Line 26: error: reference to 'stack' is ambiguous
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: