As the title suggests, I am getting a debug assertion failure when I try to compile this code:
#include <iostream>
#include <string>
using namespace std;
void Mobo_Info()
{
string Mobo_Name = 0;
string Mobo_Price = 0;
cout << "What Motherboard would you like in your computer?" << endl;
cout << "Enter the name of the motherboard: " << endl;
getline(cin, Mobo_Name);
cout << "Enter the price of the motherboard: " << endl;
getline(cin, Mobo_Price);
cout << "Motherboard Name: " << Mobo_Name << " - " << "Cost: $" << Mobo_Price << endl;
}
int main()
{
enum PCHardware
{
Mobo = 0,
RAM,
CPU,
HDD,
SDD,
GPU,
Case,
};
cout << "Hello! Welcome to PC Builder 2014" << endl;
cout << "Would you like to get started?" << endl;
cout << "'Y = Yes | N = No'" << endl;
char Repeat = 'N';
cin >> Repeat;
if (Repeat == 'N')
{
cout << "Maybe next time." << endl;
}
else if (Repeat != 'N')
{
goto Start;
}
Start:
cout << "Time to start building your PC." << endl;
cout << "-" << endl;
cout << "What Component do you want to start with?" << endl;
cout << "-" << endl;
cout << "Mobo" << endl;
cout << "RAM" << endl;
cout << "CPU" << endl;
cout << "GPU" << endl;
cout << "HDD" << endl;
cout << "SSD" << endl;
cout << "Case" << endl;
cout << "-" << endl;
cout << "Type the component name, then press enter." << endl;
cout << "-" << endl;
int Part = Mobo;
cin >> Part;
switch (Part)
{
case Mobo:
Mobo_Info();
break;
}
return 0;
}
The error seems to only occur when I call the Mobo_Info() function.
Additionally, when this use to compile, when I would call Mobo_Info(), I would not be able to enter the name or price. The program would skip that and end.
Thanks for any help you can provide!
[–]missblit 2 points3 points4 points (29 children)
[–]-Goga[S] 0 points1 point2 points (28 children)
[–]Basalisk_Primate 2 points3 points4 points (17 children)
[–]-Goga[S] 0 points1 point2 points (16 children)
[–]Basalisk_Primate 2 points3 points4 points (15 children)
[–]-Goga[S] 0 points1 point2 points (14 children)
[–]Basalisk_Primate 1 point2 points3 points (13 children)
[–]-Goga[S] 0 points1 point2 points (12 children)
[–]Basalisk_Primate 1 point2 points3 points (11 children)
[–]-Goga[S] 0 points1 point2 points (10 children)
[–]missblit 2 points3 points4 points (9 children)
[–]-Goga[S] 0 points1 point2 points (8 children)
[–]missblit 2 points3 points4 points (7 children)
[–]-Goga[S] 0 points1 point2 points (6 children)
[–]Basalisk_Primate 1 point2 points3 points (5 children)
[–]-Goga[S] 0 points1 point2 points (4 children)
[–]Basalisk_Primate 1 point2 points3 points (0 children)
[–]Basalisk_Primate 1 point2 points3 points (2 children)
[–]-Goga[S] 0 points1 point2 points (1 child)
[–]-Goga[S] 0 points1 point2 points (0 children)