Its simple. Use getch() to hold the screen. You must include the conio.h header file when using getch(). You place it at the end of your code just before the return statement in main().
See below for demo:
[CODE]

include
include

int main()
{
cout << "hello world";
getch();
return 0;
}
[/CODE]

bonnie1702 26 Newbie Poster

Hi all,

I have a double link list program that compiles ok, and when I run it, I get a message box saying that windows needs to stop the program.
Here is the code:
[CODE]

include
include

using namespace std;

class linklist
{
private:
struct dnode
{
dnode prev;
int data;
dnode
next;
}*p;
public:
linklist();
~linklist();
void d_addatbeg(int num);
void d_append(int num);
void d_addafter(int loc,int num);
void d_delete(int num);
};

linklist::linklist()
{
p = NULL;
}

linklist::~linklist()
{
dnode *q;
while (q->next != NULL)
{
q = p->next;
delete p;
p = q;
}
}

void linklist::d_addatbeg(int num)
{
dnode *q;
q = new dnode;
q->prev = NULL;
q->data = num;
q->next = p;
p->prev = q;
p = q;
}

void linklist::d_append(int num)
{
dnode q,r;
q = p;
if (q == NULL)
{
q = new dnode;
q->prev = NULL;
q->data = num;
q->next = NULL;
p = q;
}
else
{
while (q->next != NULL)
q = q->next;
r = new dnode;
r->data = num;
r->next = NULL;
r->prev = q;
q->next = r;
}
}

void linklist::d_addafter(int loc,int num)
{
dnode q;
q = p;
for (int i = 0;i < loc;i++)
{
q = q->next;
if (q == NULL)
{
cout << "There are less than " << loc << " elements";
return;
}
}
q = q->prev;
dnode
temp = new dnode;
temp->data = num;
temp->prev = q;
temp->next = q->next;
temp->next->prev = temp;
q->next = temp;
}

void linklist::d_delete(int num) ...

Hi there,
Saw your question here, so decided to give you some advice. First, no one is going to spoon feed you any code unless you have made an effort and have got to the point where you are pulling you hair out. Second, Im a beginner in c++, and although I find some parts tricky, I like to find out by myself before approaching anyone on the forum. ie read some books, google it etc.
I have just coded your homework, and found it to be extremely easy, even for me. It is a very straightforward employee example in a nice clean class. Have a go, and if in some difficulty or do not understand something, post your code and then we can help you. If we give you the whole program, you are not really learning anything, nor will you be able to grasp or understand anything. If you have only just started learning classes, you would do well to grasp the basics now as its only going to get more complicated.

Try checking out this site, they have some basic tutorials on c++ plus other languages:
[URL="http://www.warebizprogramming.com"][/URL][url]www.warebizprogramming.com[/url]

cheers
nm

hey there,

you should really try to fix up any compilations first before running the program. You also need to take particular care when using pointers. If they are not used right, they can cause problems, like crashing your system, since they point to memory locations.

You also need to post your code so that we can see more clearly where the problem is.

cheers
nm

bonnie1702 26 Newbie Poster

have you ever wondered what is going on with all these new designer x-breed dogs that around? And what about the names they have?

EG
labradoodle - labrador x poodle
schnoodle - schnauzer x poodle
spoodle - cocker spaniel x poodle
multipoo - maltese x poodle
westypoo - west highland terrier x poodle
(what is it with using poodles? couldn't think of a worst breed to cross breeds with!)
jug - jack russell x pug

and countless others.

Here's a question for you to ponder....

what would you get if you crossed a bull terrier with a shitzu?

mmmm.........

have fun!
nm:icon_cheesygrin:

pokemon are so overrated now. time to move on.

hey all

we dont have halloween 'officially' here in australia, yet stores sell costumes and plastic pumpkin baskets, and promote sweets. Also we dont usually have 99% of kids running around the neighbourhood, if you going to let the kids go trick or treating, its best to have adult supervision, there is always some weirdo around. Last year, i think only one kid came to my house, this year, none.
Its the same with valentines day, so much commercialism here for a holiday that has got nothing to do with us down under!
I wouldn't be surprised it we adopt thanksgiving next.
I will admit that I like christmas for these reasons:

[LIST]
[]all that xmas music and decorations lift up my spirits and put me in a cheery mood.
[
]spending time with family (isnt that what it should be about?)
[]shopping!!!!!(what woman doesn't like that? and xmas is a good excuse to go shopping)
[
]seeing the joy on my kids faces when they open their presents to reveal something that they always wanted.
[*]xmas is known as the 'silly season', so it is a good excuse to be silly, like singing to the xmas carols playing overhead in the supermarket while i shop - out loud.
[/LIST]
All these holidays (including easter), have become so commercialised that we forget what they really are. But maybe that's ok, because if we wanted to actually celebrate a pagan ritual, would that mean we would need a blood sacrifice?

cheers
nm:-/

well ...

sneekula commented: Hello, nice to have you post here +6

On line 31, place the second 'cout' statement on the next line.
or you could write it like this instead:

cout << "x1 = " << x1 << "x2 = " << x2;

regards
nm

Hey all!
Here is a challenge problem to try. Its actually one of the questions on my last assignment which I have already completed and handed in.

Write a program that involves two classes and simulates the operation of a petrol (gas) pump.
A customer will arrive at a random time after the start of the simulation, and will purchase a random amount of petrol.
There is only one petrol pump, which has an underground tank that stores the petrol for sale. The capacity of the underground tank is 500 litres
Declare c++ classes for the Pump (with tank included) and the Customer, which is outlined further down.
Before the next customer purchases petrol, the program must display the amount of petrol remaining in the tank, and the price per litre for the petrol.
If the amount of petrol in the supply tank is greater than the amount the customer requests to purchase, the purchase request should be completed, otherwise only the amount of petrol in the supply tank should be sold.
After the petrol requested is provided, the details of the purchase should be displayed:
this will include:
number of litres provided
total cost of petrol provided

When the simulation finishes, the program should display:
the number of customers that purchase petrol
the total amount of money from the petrol sales

  1. Write the declaration for the Customer class.
  2. Define the class fully, so that it can be used as part of your code solution to this question. ...

just letting you know, i have updated my profile

cheers
nm

Thanks! dont i feel like a dope

cheers
nm

bonnie1702 26 Newbie Poster

Hi all,
Heres a question I feel really stupid asking. How do I update my profile? cannot seem to find a link for this.

Thanks
nm

hello,
no, im not that sory guy from poland....

try the other side of the world and the opposite gender...

NM

bonnie1702 26 Newbie Poster

hi everyone!
just thought i'd check in and see how you all are. Not going too bad with my c++ programming, I am rather new to it even though I'm a little familiar with other languages like java and php etc.
I just completed my first c++ test in class last monday and got 17 out of 20 (85%), though i thought i could have done better. Am pleased that I got top marks for my first assignment.
Am currently in the middle of my second assignment, which, at first glance, i did a OMG! I read on some more and starting to relax. Then, when I REALLY started reading it and commenced coding, I went back to the OMG stage again. No but seriously its going ok, a little trickier than the first one. Most of its done except the last question which is declaring a pump and a customer class for a petrol pump simulator! I'll get there.
Looking forward to finishing school this year, however, i'm must think i need torturing some more as I've applied for uni next year (another 2 more years of schooling!). Ah well, i just keep thinking it will be worth having a decent qualification just so as to get a decent job. Which is want you really have to have these days if u want a fairly well paid and satisfying career.
Well must go now, I'm probaly boring you all,
Cheers everyone!
NM

bonnie1702 26 Newbie Poster

Just thought I'd drop by and introduce myself. I feel a little guily as I joined up about a month ago, and was intending to introduce myself, but as I have been busy, I sort of put it aside. Well anyway, about me:
I am a mature age student (I dont feel it necessary to reveal my true age yet!) who is currently studying for a diploma in IT (software development) at TAFE. Tafe, for non-aussies, stands for Technical and Further Education. Its a tertiary level, mainly with skills that many industries are looking for (business, IT, hospitality, engineering etc).
This is my second year, and I have applied to University next year to do (hopefully) a Bachelor of Business Information Systems.
I have done various programming languages - html,javascript,php,sql,java,vb and am currently studying c++, which is why I have joined this forum. Some of you out there have already helped me, and I appreciate it very much!
Well, I dont know if our teacher really teaches us anything. I am finding myself constantly going over books and stuff online to help me get by.
Getting away from programming and other IT stuff, my other interests are:
Reading
Horses
Craft
Sometimes cooking (when im in the mood)
my new laptop (its ace!)
drinking coffee
playing match 3 puzzle games online

I am wondering if this is the place if you want to let off a little steam? Or is there another section in the forum just for that?
I only ...

Hi all,

Just want to say thanks for your help, sorry it took so long to get back. I got the program working just fine.

Thanks again
n.m

bonnie1702 26 Newbie Poster

Hi there!
I am just starting out in c++ and so far, its going ok. I have a small problem in a simple program that is frustrating me, so I am hoping someone will point me in the right direction of where I've gone wrong.
The program basically prompts the user to input two integer values, then outputs all the odd numbers between these two integer values (and their squares), and also outputs all the even numbers between the two inputted values, along with the sum of these even numbers.
I have the program working sufficiently, so long as the first value entered by the user is smaller than the second value entered. Thats the small problem I've encountered; it should not make a difference between the size of the values entered. I think i need to change the condition in the for loop, but I've tried various conditions without success
Here is the program:

[ICODE]

include
include
include

using namespace std;

int main()
{
int a,b,a1,b2,square; //declaring variables
int sum = 0;
cout << "Enter two integers: " << endl; //user inputs two integers
cin >> a >> b;
cout << "The numbers entered are: " << endl; //displays the integers listed
cout << "1. " << a << endl;
cout << "2. " << b << endl;
a1 = a;
b2 = b;
//for odd numbers
cout << "The odd numbers between " << a << " and " << b <<
", along with ...

Salem commented: Congratulations on being able to use code tags on your first post. Keep up the good work. +20