Say I had a program running... like I was in the middle of entering 100 numbers into an array... is there a way I could program it so that one the user hits a key, say "cntrl-A", that the process will stop?

Additionally,
I was reading these lecture notes and the teacher said
The header file (blahblah.h) for a simple blahblah library is:

and then gave some code....am I suppose to type this in the program above the include# <blahblah.h> or below?

Thanks..

You can use ctrl-z (ctrl-d in *nix systems) to signal end of input - it works the same as running out of data when reading a file.

You might have something like

int arr[100] = { 0 };
int i = 0;
while( i < 100 && cin >> arr[i] )
   i++;

That will stop the input when either you run out of space in the array or you press a ctrl-z

As to blah.h, if it's a local file (something in your project, not part of the compiler libraries) you include it using double quotes #include "my_header.h" blah.h is a separate file, with code that will be included into your program at compile time, just like the system libraries that you include.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.