#ifndef UNICODE
#define UNICODE
#endif
#ifndef _UNICODE
#define _UNICODE
#endif
#include <windows.h>
#include <iostream>
#include <string>
#include <tchar.h>
int main()
{
SetConsoleTitle(_T("Algebra I Console Window Calculator"));
/*right here*/for (int Counter=0;Counter!=1;){
// The Begining Of The Code, Depending on What Letter Is Entered It Will Change The Type Of Equation
std::string Problem;
std::cout<<"Enter The Chapter Of The Problem (Type Help For A List): ";
getline (std::cin,Problem);
//A List of Options
if (Problem=="Help"||Problem=="help"){
std::cout<<std::endl;
std::cout<<"1.2 = Exponents and Powers"<<std::endl;
std::cout<<"3.1 = Solving Equations Using Addition and Subtraction"<<std::endl;
std::cout<<"9.1 = Solving Quadratic Equations by Finding Square Roots"<<std::endl;
std::cout<<"9.6 = Applications of the Discriminant"<<std::endl;
std::cout<<"10.7 = Factoring Special Products"<<std::endl;
std::cout<<"Help = Display Options"<<std::endl;
std::cout<<"Close = Closes The Program"<<std::endl;
std::cout<<std::endl;}
//Closes The Program Properly
if (Problem=="Close"||Problem=="close"){
return 0;}
//Exponents and Powers(Section 1.2)
if(Problem=="1.2") {
double Base;
double Exponent;
std::cout<<"Enter The Base: ";
std::cin>>Base;
std::cout<<"Enter The Exponent: ";
std::cin>>Exponent;
double Result (1);
for (int Counter2=0;Counter2<Exponent;Counter2++){
Result*=Base;}
std::cout<<Result<<std::endl;}
//Solving Equations Using Addition and Subtraction(Section 3.1)
if(Problem=="3.1"){
double C;
double B;
std::cout<<"Enter It In The Format A+B=C"<<std::endl;
std::cout<<"Enter B's Value: ";
std::cin>>B;
std::cout<<"Enter C's Value: ";
std::cin>>C;
double A(C-B);
std::cout<<"A Equals: "<<A<<std::endl;}
//Solving Quadratic Equations by Finding Square Roots(Section 9.1)
if(Problem=="9.1"){
int Correct_Result;
int Testing_Number(0);
std::cout<<"Enter The Perfect Square To Find The Root Of: ";
std::cin>>Correct_Result;
for(double Test_Result=0;Test_Result!=Correct_Result;){
Testing_Number++;
Test_Result=Testing_Number*Testing_Number;}
std::cout<<"The Square Root Is "<<Testing_Number<<std::endl;}
//Applications of the Discriminant(Section 9.6)
if(Problem=="9.6") {
int B;
int A;
int C;
std::cout<<"We Are Going To Calculate The Amount Of Solutions And X Intercepts"<<std::endl;
std::cout<<"Enter B's Value: ";
std::cin>>B;
std::cout<<"Enter A's Value: ";
std::cin>>A;
std::cout<<"Enter C's Value: ";
std::cin>>C;
int Answer(B*B-4*A*C);
std::cout<<Answer<<std::endl;
if (Answer>0) {
std::cout<<"There Are 2 Solutions And 2 X Intercepts."<<std::endl;}
if (Answer==0){
std::cout<<"There is 1 Solution And 1 X Intercept."<<std::endl;}
if (Answer<0){
std::cout<<"There Are No Solutions Or X Intercepts."<<std::endl;}}
//Factoring Special Products(Section 10.7)
if(Problem=="10.7"){
double a;
double b;
std::string Format;
std::cout<<"What Format Is The Problem In"<<std::endl;
std::cout<<"1 = a^2-b^2"<<std::endl;
std::cout<<"2 = a^2+2ab+b^2"<<std::endl;
std::cout<<"3 = a^2-2ab+b^2"<<std::endl;
std::cout<<":";
getline(std::cin,Format);
if(Format=="1"){
std::cout<<"Enter a: ";
std::cin>>a;
std::cout<<"Enter b: ";
std::cin>>b;
std::cout<<"("<<a<<"+"<<b<<")("<<a<<"-"<<b<<")"<<std::endl;}
if(Format=="2"){
std::cout<<"Enter a: ";
std::cin>>a;
std::cout<<"Enter b: ";
std::cin>>b;
std::cout<<"("<<a<<"+"<<b<<")^2"<<std::endl;}
if(Format=="3"){
std::cout<<"Enter a: ";
std::cin>>a;
std::cout<<"Enter b: ";
std::cin>>b;
std::cout<<"("<<a<<"-"<<b<<")^2"<<std::endl;}
}
}
}
the output is displayed as... well for example if I enter 9.1
Enter The chapter Of The Problem (Type Help For a List): 9.1
Enter The Perfect Square To Find The Root Of: 4
The Square Root Is 2
Enter The Chapter Of The Problem(Type Help For A List):Enter The Chapter Of The Problem(Type Help For A List):
instead of
Enter The chapter Of The Problem (Type Help For a List): 9.1
Enter The Perfect Square To Find The Root Of: 4
The Square Root Is 2
Enter The Chapter Of The Problem(Type Help For A List):
but it only happens when I enter numbers at the beginning. If I enter Any words it works fine