C++ Not being in input twice

I am making a calculator that works with imaginary numbers. When I run it in the terminal I am able to put the first two inputs however the second one glitches out.(Look at screenshot for reference) Here is my Handler with get_complex_input() that runs at this part and Complex file.

#include
using namespace std;
#pragma once

class Complex {
private:
float real;
float imaginary;

public:
Complex() : real(0), imaginary(0) {}

Complex(float r, float i) : real(r), imaginary(i) {}

Complex operator+(Complex rhs) {
return Complex(this->real + rhs.real, this->imaginary + rhs.imaginary);
}
Complex operator-(Complex rhs) {
return Complex(this->real – rhs.real, this->imaginary – rhs.imaginary);
}
Complex operator*(const Complex& other) const {
float new_real = (this->real * other.real) – (this->imaginary * other.imaginary);
float new_imaginary = (this->real * other.imaginary) + (this->imaginary * other.real);
return Complex(new_real, new_imaginary);
}

Complex operator/(const Complex& other) const {
float denominator = (other.real * other.real) + (other.imaginary * other.imaginary);
float new_real = ((this->real * other.real) + (this->imaginary * other.imaginary)) / denominator;
float new_imaginary = ((this->imaginary * other.real) – (this->real * other.imaginary)) / denominator;
return Complex(new_real, new_imaginary);
}

Function to find the conjugate of a complex number
Complex conjugate() {
return Complex(this->real, -(this->imaginary));
}

A helper function to print the complex number
void print() const {
if (imaginary >= 0)
cout << real << ” + ” << imaginary << “i” << endl;
else
cout << real << ” – ” << -imaginary << “i” << endl;
}

};

#include
#include “Complex.h”
#pragma once
using namespace std;

class Handler {
public:
Function to display the menu and get the user’s choice
static int print_and_get_choices() {
int choice;
cout << “Complex Numbers Calculator” << endl;
cout << “1. Add two complex numbers” << endl;
cout << “2. Subtract two complex numbers” << endl;
cout << “3. Multiply two complex numbers” << endl;
cout << “4. Divide two complex numbers” << endl;
cout << “5. Find the conjugate of a complex number” << endl;
cout << “6. Exit” << endl;
cout << “Enter your choice: “;
cin >> choice;
return choice;
}

Function to add two complex numbers
static void add_two_complex_numbers() {
Complex num1 = get_complex_input();
Complex num2 = get_complex_input();
Complex result = num1 + num2;
cout << “Result of addition: “;
result.print();
}

Function to subtract two complex numbers
static void subtract_two_complex_numbers() {
Complex num1 = get_complex_input();
Complex num2 = get_complex_input();
Complex result = num1 – num2;
cout << “Result of subtraction: “;
result.print();
}

Function to multiply two complex numbers
static void multiply_two_complex_numbers() {
Complex num1 = get_complex_input();
Complex num2 = get_complex_input();
Complex result = num1 * num2;
cout << “Result of multiplication: “;
result.print();
}

Function to divide two complex numbers
static void divide_two_complex_numbers() {
Complex num1 = get_complex_input();
Complex num2 = get_complex_input();
Complex result = num1 / num2;
cout << “Result of division: “;
result.print();
}

Function to find the conjugate of a complex number
static void find_conjugate_of_a_complex_number() {
Complex num = get_complex_input();
Complex result = num.conjugate();
cout << “Conjugate: “;
result.print();
}

private:
Helper function to get user input for a complex number
static Complex get_complex_input() {
float real, imaginary;
cout << “Enter the real part: “;
cin >> real;
cout << “Enter the imaginary part: “;
cin >> imaginary;
return Complex(real, imaginary);
}
};

I just want to make the inputs work to check my functions. Also, using ./a.out on the folder terminal if that means anything

1

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật