Skip to content

itayG98/22

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

81 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

# 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

๐Ÿ› ๏ธ Compilation

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

โ–ถ๏ธ Usage

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

๐Ÿงฎ Supported Commands

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

โ— Input Rules & Error Handling

The program handles:

  • Missing or extra parameters
  • Invalid command names
  • Misplaced or missing commas
  • Input with extra whitespace
  • Invalid variable names or number formats

โœ… Submission Checklist

  • 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

๐Ÿงช Testing Suggestions

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

About

Maman 22 Course 20465 Grade 100 2025B

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published