lab1_zad1
#include <cstring>
#include <iostream>
using namespace std;
struct transaction
{
int id;
int amount;
int provision;
bool debitOrCredit;
};
void result(struct transaction *t, int n)
{
bool flag = false;
for (int i = 0; i < n; i++)
{
if (t[i].debitOrCredit == 1){
flag = true;
cout << t[i].id <<" "<< (t[i].amount + t[i].provision) << endl;
}
}
if(!flag)
{
cout <<"No credit card transactions!"<<endl;
}
}
int main()
{
int n;
cin >> n;
transaction arr[n];
for(int i = 0; i < n; i++)
{
cin >> arr[i].id >> arr[i].amount >> arr[i].provision >> arr[i].debitOrCredit;
}
result(arr,n);
}
Editor is loading...
Leave a Comment