From 47b4a07cc80fbd4d6cafd736753b9768b4f224bf Mon Sep 17 00:00:00 2001 From: eshaap Date: Tue, 9 Apr 2024 13:26:14 +0000 Subject: [PATCH 1/5] hii --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..6ce15b87b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM ubuntu +RUN apt update +RUN apt install apache2 -y +ADD . /var/www/html +ENTRYPOINT apachectl -D FOREGROUND From 64fa8e00ac941bdec21ec40b6c4acd5f9b3c8b16 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 16 Apr 2024 09:44:51 +0000 Subject: [PATCH 2/5] deleted a file --- Dockerfile | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 6ce15b87b..000000000 --- a/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM ubuntu -RUN apt update -RUN apt install apache2 -y -ADD . /var/www/html -ENTRYPOINT apachectl -D FOREGROUND From 9907fb4b2909fa8acee7b081e86ab2c630bc1eb6 Mon Sep 17 00:00:00 2001 From: eshaap Date: Tue, 16 Apr 2024 10:07:58 +0000 Subject: [PATCH 3/5] created a file --- a.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 a.txt diff --git a/a.txt b/a.txt new file mode 100644 index 000000000..5f79ef3d7 --- /dev/null +++ b/a.txt @@ -0,0 +1,2 @@ +hey there!! +how are you?? From cea75a04df69c5a4057f024f04d22edf1e3f9ae7 Mon Sep 17 00:00:00 2001 From: eshaap Date: Sat, 1 Mar 2025 12:26:50 +0530 Subject: [PATCH 4/5] this is new file for section A --- sectionA.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 sectionA.txt diff --git a/sectionA.txt b/sectionA.txt new file mode 100644 index 000000000..c2781fd7c --- /dev/null +++ b/sectionA.txt @@ -0,0 +1 @@ +Section A From 4674c25566d6fda5f787bcd23fd52d93ebf8bc37 Mon Sep 17 00:00:00 2001 From: eshaap Date: Sat, 1 Mar 2025 13:19:01 +0530 Subject: [PATCH 5/5] smart banking system --- smart.c | 189 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 smart.c diff --git a/smart.c b/smart.c new file mode 100644 index 000000000..f37e7df07 --- /dev/null +++ b/smart.c @@ -0,0 +1,189 @@ +#include +#include +#include + +// Define a structure for a transaction +typedef struct Transaction { + char type[10]; // Transaction type (Deposit/Withdraw) + double amount; // Transaction amount +} Transaction; + +// Stack structure +#define MAX 5 // Maximum size of the stack +Transaction stack[MAX]; +int top = -1; + +// Function to check if the stack is full +int isFull() { + return top == MAX - 1; +} + +// Function to check if the stack is empty +int isEmpty() { + return top == -1; +} + +// Function to push a transaction onto the stack +void push(char *type, double amount) { + if (isFull()) { + printf("Stack Overflow: Cannot add more transactions.\n"); + return; + } + + top++; + strcpy(stack[top].type, type); + stack[top].amount = amount; + printf("Transaction %s of $%.2f added.\n", type, amount); +} + +// Function to pop a transaction from the stack (undo) +void pop() { + if (isEmpty()) { + printf("No transactions to undo.\n"); + return; + } + + printf("Undoing %s of $%.2f\n", stack[top].type, stack[top].amount); + top--; +} + +// Function to view the last transaction (peek) +void peek() { + if (isEmpty()) { + printf("No transactions available.\n"); + return; + } + + printf("Last Transaction: %s of $%.2f\n", stack[top].type, stack[top].amount); +} + +// Function to display all transactions +void displayTransactions() { + if (isEmpty()) { + printf("No transactions to display.\n"); + return; + } + + printf("Transactions:\n"); + for (int i = 0; i <= top; i++) { +#include +#include +#include + +// Define a structure for a transaction +typedef struct Transaction { + char type[10]; // Transaction type (Deposit/Withdraw) + double amount; // Transaction amount +} Transaction; + +// Stack structure +#define MAX 5 // Maximum size of the stack +Transaction stack[MAX]; +int top = -1; + +// Function to check if the stack is full +int isFull() { + return top == MAX - 1; +} + +// Function to check if the stack is empty +int isEmpty() { + return top == -1; +} + +// Function to push a transaction onto the stack +void push(char *type, double amount) { + if (isFull()) { + printf("Stack Overflow: Cannot add more transactions.\n"); + return; + } + + top++; + strcpy(stack[top].type, type); + stack[top].amount = amount; + printf("Transaction %s of $%.2f added.\n", type, amount); +} + +// Function to pop a transaction from the stack (undo) +void pop() { + if (isEmpty()) { + printf("No transactions to undo.\n"); + return; + } + + printf("Undoing %s of $%.2f\n", stack[top].type, stack[top].amount); + top--; +} + +// Function to view the last transaction (peek) +void peek() { + if (isEmpty()) { + printf("No transactions available.\n"); + return; + } + + printf("Last Transaction: %s of $%.2f\n", stack[top].type, stack[top].amount); +} + +// Function to display all transactions +void displayTransactions() { + if (isEmpty()) { + printf("No transactions to display.\n"); + return; + } + + printf("Transactions:\n"); + for (int i = 0; i <= top; i++) { + printf("%d. %s of $%.2f\n", i + 1, stack[i].type, stack[i].amount); + } +} + +int main() { + int choice; + double amount; + char type[10]; + + while (1) { + printf("\nSmart Banking System\n"); + printf("1. Deposit\n"); + printf("2. Withdraw\n"); + printf("3. Undo Last Transaction\n"); + printf("4. View Last Transaction\n"); + printf("5. View All Transactions\n"); + printf("6. Exit\n"); + printf("Enter your choice: "); + scanf("%d", &choice); + + switch (choice) { + case 1: + printf("Enter deposit amount: "); + scanf("%lf", &amount); + strcpy(type, "Deposit"); + push(type, amount); + break; + case 2: + printf("Enter withdrawal amount: "); + scanf("%lf", &amount); + strcpy(type, "Withdraw"); + push(type, amount); + break; + case 3: + pop(); + break; + case 4: + peek(); + break; + case 5: + displayTransactions(); + break; + case 6: + printf("Exiting...\n"); + exit(0); + break; + default: + printf("Invalid choice! Please try again.\n"); + } + } + + return 0; +}