# MAMAN 22 โ 2025B
**Course 20465 โ Systems Programming in C (ANSI C90)**
**Open University of Israel**
**Project Directory: `mycomp/`**
## ๐ Overview
This project implements a command-line based program that handles operations on complex numbers. It is part of MAMAN 22 for semester 2025B in the Systems Programming course (20465). The program is written in ANSI C90 and intended to run on a Linux system (Ubuntu 16).
## ๐ง Purpose
The goal is to practice:
- Structuring code using `.c` and `.h` files
- Parsing string input manually
- Performing arithmetic on complex numbers
- Handling user commands and input validation
- Writing portable, standard-compliant ANSI C90 code
## ๐งฑ File Structure
mycomp/
โโโ Makefile # Build script for Ubuntu
โโโ Ubunto\_Makefile # Duplicate makefile (legacy)
โโโ common\_types.h # Shared type definitions and constants
โโโ complex.c # Complex number operations
โโโ complex.h # Header for complex.c
โโโ instructions.pdf # Official instructions for MAMAN 22
โโโ mycomp.c # Main program and command dispatcher
โโโ mycomp.h # Header for dispatcher functions
โโโ string\_utils.c # Utility functions for parsing and string handling
โโโ string\_utils.h # Header for string\_utils.c
To compile the program on Ubuntu:
cd mycomp
make
Manual compilation (if needed):
gcc -ansi -pedantic -Wall -Wextra -o mycomp mycomp.c complex.c string_utils.c
After compiling:
./mycomp
You can enter one command per line. For example:
read_comp A, 3.0, -2.5
print_comp A
add_comp A, B
stop
Command | Description |
---|---|
read_comp |
Assign values to a complex variable |
print_comp |
Print a complex number |
add_comp |
Add two complex numbers |
sub_comp |
Subtract one complex number from another |
mult_comp_real |
Multiply a complex number by a real number |
mult_comp_img |
Multiply a complex number by an imaginary number |
mult_comp_comp |
Multiply two complex numbers |
abs_comp |
Calculate the absolute value of a complex number |
stop |
Exit the program |
The program handles:
- Missing or extra parameters
- Invalid command names
- Misplaced or missing commas
- Input with extra whitespace
- Invalid variable names or number formats
- All source files (
.c
and.h
) - Working Makefile
- README file
- Follows ANSI C90 standard
- Works on Ubuntu 16
- Handles all input validation as described in
instructions.pdf
Try testing:
- Each valid command
- Invalid commands (e.g.,
add_com
,printcomp
) - Missing arguments (e.g.,
add_comp A
) - Extra text after commands (e.g.,
stop now
) - Whitespace variations