It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming C and C++ Forum

Stopping executing script...

Stopping executing script...

Postby Dantenas on Mon Sep 29, 2008 3:31 pm

Hello, I don't have much knowledge, but I am still learning. (Sorry for imperfect English...)
Script:
// pattern.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


#include <iostream>
using namespace std;

int main ()
{
int i;
cout << "Hello World!" << ".\n";
cout << "Please enter the text: ";
cin >> i;
cout << ".\n";
cout << "You have entered: " << i;
return 0;
}

This was compiled in visual cpp 2008. After execution when I input variables i value, the window disappears and I didn't make to read what I have written. I need to know the best ways to stop window from disappearing.
Hope someone could help me...
Dantenas
 
Posts: 40
Joined: Sat Sep 06, 2008 4:06 pm

Re: Stopping executing script...

Postby instinct46 on Mon Dec 15, 2008 6:09 pm

Well I don't know alot of cpp but my understanding is that any cpp compiler will use both cpp & c syntaxs, in c you would put.


//Clears anything in keyboard input so you dont get any input signals
//passed over from any other part of the program
//The printf is just so that anyone else remembers they have
//to press enter to continue.
printf("Please press 'Enter' to continue
fflush(stdin);
getc();

//Just place it just before the return 0; command

return 0;
}
User avatar
instinct46
50+ Club
 
Posts: 90
Joined: Tue Mar 27, 2007 1:07 pm
Location: St Helens, England

Re: Stopping executing script...

Postby instinct46 on Mon Dec 15, 2008 6:12 pm

Sorry got one of the commands wrong lol, heres an example program. As I said above im not sure if this will work as I'm only a C programmer.

#include <stdio.h>

void main()
{
fflush(stdin);
getchar();

return 0;
}
User avatar
instinct46
50+ Club
 
Posts: 90
Joined: Tue Mar 27, 2007 1:07 pm
Location: St Helens, England


Who is online

Users browsing this forum: No registered users and 0 guests