Added comments, authorship declaration, and a msg
This commit is contained in:
parent
1a79de2882
commit
f8227cacb0
1 changed files with 66 additions and 1 deletions
65
src/main.c
65
src/main.c
|
@ -1,6 +1,41 @@
|
||||||
|
/*
|
||||||
|
* Authorship Declaration:
|
||||||
|
* (1) I certify that the program contained in this submission is completely
|
||||||
|
* my own individual work, except where explicitly noted by comments that
|
||||||
|
* provide details otherwise. I understand that work that has been developed
|
||||||
|
* by another student, or by me in collaboration with other students,
|
||||||
|
* or by non-students as a result of request, solicitation, or payment,
|
||||||
|
* may not be submitted for assessment in this subject. I understand that
|
||||||
|
* submitting for assessment work developed by or in collaboration with
|
||||||
|
* other students or non-students constitutes Academic Misconduct, and
|
||||||
|
* may be penalized by mark deductions, or by other penalties determined
|
||||||
|
* via the University of Melbourne Academic Honesty Policy, as described
|
||||||
|
* at https://academicintegrity.unimelb.edu.au.
|
||||||
|
*
|
||||||
|
* (2) I also certify that I have not provided a copy of this work in either
|
||||||
|
* softcopy or hardcopy or any other form to any other student, and nor will
|
||||||
|
* I do so until after the marks are released. I understand that providing
|
||||||
|
* my work to other students, regardless of my intention or any undertakings
|
||||||
|
* made to me by that other student, is also Academic Misconduct.
|
||||||
|
*
|
||||||
|
* (3) I further understand that providing a copy of the assignment
|
||||||
|
* specification to any form of code authoring or assignment tutoring
|
||||||
|
* service, or drawing the attention of others to such services and code
|
||||||
|
* that may have been made available via such a service, may be regarded
|
||||||
|
* as Student General Misconduct (interfering with the teaching activities
|
||||||
|
* of the University and/or inciting others to commit Academic Misconduct).
|
||||||
|
* I understand that an allegation of Student General Misconduct may arise
|
||||||
|
* regardless of whether or not I personally make use of such solutions
|
||||||
|
* or sought benefit from such actions.
|
||||||
|
*
|
||||||
|
* Signed by: Rory Healy 964275
|
||||||
|
* Dated: 16th May 2020
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/* constants */
|
||||||
#define STAGE_FORMATTING_STRING "========================="
|
#define STAGE_FORMATTING_STRING "========================="
|
||||||
#define STAGE_ONE 1
|
#define STAGE_ONE 1
|
||||||
#define STAGE_TWO 2
|
#define STAGE_TWO 2
|
||||||
|
@ -13,6 +48,7 @@
|
||||||
#define TRANSACTION_TIME_LEN 19
|
#define TRANSACTION_TIME_LEN 19
|
||||||
#define END_CREDIT_CARDS "%%%%%%%%%%"
|
#define END_CREDIT_CARDS "%%%%%%%%%%"
|
||||||
|
|
||||||
|
/* structure typedefs */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char card_id[CREDIT_CARD_ID_LEN];
|
char card_id[CREDIT_CARD_ID_LEN];
|
||||||
int daily_lim;
|
int daily_lim;
|
||||||
|
@ -26,12 +62,17 @@ typedef struct {
|
||||||
int trans_amount;
|
int trans_amount;
|
||||||
} transaction_t;
|
} transaction_t;
|
||||||
|
|
||||||
|
/* function prototypes */
|
||||||
|
|
||||||
void print_stage(int stage_num);
|
void print_stage(int stage_num);
|
||||||
void stage_one();
|
void stage_one();
|
||||||
void stage_two();
|
void stage_two();
|
||||||
void stage_three();
|
void stage_three();
|
||||||
void stage_four();
|
void stage_four();
|
||||||
|
|
||||||
|
void read_one_line();
|
||||||
|
|
||||||
|
/* the main function */
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
/* holds all the credit cards */
|
/* holds all the credit cards */
|
||||||
credit_card_t all_cards[MAX_NUM_CARDS];
|
credit_card_t all_cards[MAX_NUM_CARDS];
|
||||||
|
@ -67,6 +108,10 @@ void print_stage(int stage_num) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void read_one_line() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* stage 1: reading one credit card record */
|
/* stage 1: reading one credit card record */
|
||||||
void stage_one() {
|
void stage_one() {
|
||||||
print_stage(STAGE_ONE);
|
print_stage(STAGE_ONE);
|
||||||
|
@ -90,6 +135,7 @@ void stage_three() {
|
||||||
print_stage(STAGE_THREE);
|
print_stage(STAGE_THREE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,5 +144,24 @@ void stage_four() {
|
||||||
print_stage(STAGE_FOUR);
|
print_stage(STAGE_FOUR);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* _ _ _ _
|
||||||
|
* /\ | | (_) | | | |
|
||||||
|
* / \ | | __ _ ___ _ __ _ | |_ | |__ _ __ ___ ___
|
||||||
|
* / /\ \ | | / _` | / _ \ | '__| | | | __| | '_ \ | '_ ` _ \ / __|
|
||||||
|
* / ____ \ | | | (_| | | (_) | | | | | | |_ | | | | | | | | | | \__ \
|
||||||
|
* /_/ \_\ |_| \__, | \___/ |_| |_| \__| |_| |_| |_| |_| |_| |___/
|
||||||
|
* __/ |
|
||||||
|
* |___/
|
||||||
|
* ______ _
|
||||||
|
* /\ | ____| | |
|
||||||
|
* / \ _ __ ___ | |__ _ _ _ __ | |
|
||||||
|
* / /\ \ | '__| / _ \ | __| | | | | | '_ \ | |
|
||||||
|
* / ____ \ | | | __/ | | | |_| | | | | | |_|
|
||||||
|
* /_/ \_\ |_| \___| |_| \__,_| |_| |_| (_)
|
||||||
|
*
|
||||||
|
*/
|
Loading…
Reference in a new issue