#include <cstdlib>
#include <iostream>
#include<string.h>
using namespace std;
int main()
{
int n;
int arr[4][3]={0};
while( cin >> n )
{
for( int b = 0; b < n; b++ )
{
for( int a = 0; a < 3; a++ )
{
cin >> arr[b][a];
if( arr[b][0] == 1 && a == 2 )
{
arr[b][0] = arr[b][1]+arr[b][2];
}
else if( arr[b][0] == 2 && a == 2 )
{
arr[b][0] = arr[b][1]-arr[b][2];
}
else if( arr[b][0] == 3 && a == 2 )
{
arr[b][0] = arr[b][1]*arr[b][2];
}
else if( arr[b][0] == 4 && a == 2 )
{
arr[b][0] = arr[b][1]/arr[b][2];
}
}
}
for( int q = 0; q < n; q++ )
{
for( int w = 0; w < 1; w++ )
cout << arr[q][w] << endl;
}
}
return 0;
}
RE (SIGSEGV)執行時期錯誤記憶體區段錯誤!
Segmentation fault