Skip to content

CodeX-SIT/CPP-Task2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPP-Task2 — Control Structures & Basic Operations

This repository contains four progressively challenging C++ exercises built around the following topics:

  1. C++ Header files & Operators
  2. C++ Reference Variables & Typecasting
  3. Constants, Manipulators & Operator Precedence
  4. Control Structures (If-Else and Switch-Case)
  5. Loops (For, While, and Do-While)

Work to Complete

  • Question1: Temperature Converter

    • Fill-in-the-blanks exercise
    • Focus: operators, type casting, basic I/O formatting
    • Practice with number conversions and decimal formatting
  • Question2: Grade Calculator

    • Fill-in-the-blanks exercise
    • Focus: if-else statements, input validation
    • Calculate grades based on marks using conditions
  • Question3: Number Pattern Generator

    • Fill-in-the-blanks exercise
    • Focus: nested loops, pattern printing
    • Create different number patterns using loops and spacing
  • Question4: Simple Calculator

    • Fill-in-the-blanks exercise
    • Focus: switch-case, menu system, error handling
    • Implement multiple mathematical operations with proper validation

Repository Structure

Each question is in its own folder (Question1/, Question2/, etc.) and contains:

  • qX.cpp — Template file with TODO comments marking where to add code
  • README.md — Detailed instructions, expected output, and requirements

How to Compile & Run (macOS / zsh)

# compile
g++ -std=c++17 Question1/q1.cpp -o Question1/q1
g++ -std=c++17 Question2/q2.cpp -o Question2/q2
g++ -std=c++17 Question3/q3.cpp -o Question3/q3
g++ -std=c++17 Question4/q4.cpp -o Question4/q4

# run
./Question1/q1
./Question2/q2
./Question3/q3
./Question4/q4

What to Submit

  1. Complete all TODO sections in each question's cpp file
  2. Make sure each program:
    • Compiles without errors
    • Produces exactly the expected output
    • Handles invalid inputs appropriately
    • Is well-commented and readable

Grading Criteria

  • Correctness (40%)

    • Programs compile and run without errors
    • Output matches the expected format exactly
    • Proper handling of invalid inputs
  • Code Quality (30%)

    • Clear and meaningful variable names
    • Proper indentation and formatting
    • Helpful comments explaining logic
  • Concept Understanding (30%)

    • Proper use of control structures
    • Appropriate type casting and operators
    • Efficient loop implementations
    • Proper error handling

Getting Started

  1. Read the main README (this file) completely
  2. Go through each question's README for specific requirements
  3. Start with Question1 and progress in order
  4. Test thoroughly with sample inputs before submitting

Remember: The goal is to understand and practice fundamental C++ concepts. Take your time to understand each concept before implementing.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages