So I am new to coding and i have been taught using Code Blocks in school. When i enter code into code blocks it does what i want and then comes up with a message at the end like "process returned 0, press enter to continue". This is exactly what i want but i cant export all my code as a single solid EXE. So i tried using Microsoft visual studio and whenever i get done with the cin (code down below) it briefly pops up my next cout and then the console goes away. Everything i have tried, like adding cin.get() below the final cout line doesn't do anything. The only thing that will work is adding a new int or char and having to enter a value in before i press enter. Why is it doing this?
Sample code:
Code:#include <iostream> using namespace std; int main() { int a; cout << "Hello world!" << endl; cout<<"What is your age?"; cin>>a; cout<<"\n You will be 30 in "<<30-a<<"years."; //this is where i put the cin.get() return 0; }