I have written a simple hello world program in c++ to make sure it wasn't a programming error that was causing my difficulties. If you would like to check over the program:
#include "stdafx.h"
#include <iostream>
int main()
{
std::cout << "Hello, World\n";
std::cin.ignore();
return 0;
}
Anyways, when I open up a program that I made months ago. (I recently started learning again) and run that program it outputs as should. When creating a new program from scratch the program builds and opens up a console window but remains at a blank screen. I believe this is the fault of the IDE and I am missing a setting somewhere.
New Program:
#include "stdafx.h"
#include <iostream>
int main()
{
std::cout << "Hello, World\n";
std::cin.ignore();
return 0;
}
Ctrl+F5: Blank Console
Old Program:
#include "stdafx.h"
#include <iostream>
int doubleNumber(int x) {
return x * 2;
}
int main()
{
std::cout << "Starting Main" << std::endl;
int y;
std::cout << "Please enter a value you would like to double: ";
std::cin >> y;
y = doubleNumber(y);
std::cout << y << std::endl;
std::cout << "Ending Main" << std::endl;
std::cin.clear();
std::cin.ignore(32767, '\n');
std::cin.get();
return 0;
}
Ctrl+F5: Console as it should be
This problem occurs in all cases of the old and new programs. The programs that I have written today do not display anything to the console, but the programs that I have written in the past perform as inteded.