Click here to Skip to main content
15,909,898 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow do i automatically scroll to the bottom of a edit control when text gets added? Pin
Redeemer-dk1-Dec-02 10:03
Redeemer-dk1-Dec-02 10:03 
AnswerRe: How do i automatically scroll to the bottom of a edit control when text gets added? Pin
Daniel Ferguson1-Dec-02 14:17
Daniel Ferguson1-Dec-02 14:17 
Generalfriend member function can't access private member var?? what's wrong Pin
ttzzgg_807131-Dec-02 8:29
ttzzgg_807131-Dec-02 8:29 
Generalerror C2248: 'm_idParent' : cannot access private member declared in class 'DownKind'------>this is the error infomation Pin
ttzzgg_807131-Dec-02 8:31
ttzzgg_807131-Dec-02 8:31 
GeneralRe: error C2248: 'm_idParent' : cannot access private member declared in class 'DownKind'------>this is the error infomation Pin
Christian Graus1-Dec-02 9:51
protectorChristian Graus1-Dec-02 9:51 
GeneralRe: friend member function can't access private member var?? what's wrong Pin
Christian Graus1-Dec-02 9:50
protectorChristian Graus1-Dec-02 9:50 
GeneralRe: friend member function can't access private member var?? what's wrong Pin
ttzzgg_807131-Dec-02 22:24
ttzzgg_807131-Dec-02 22:24 
GeneralQueue help Pin
ian_ok1-Dec-02 4:15
ian_ok1-Dec-02 4:15 
Below is my queue, I'm having problems getting it to show values in the queue and the queue doesn't seem to like you adding other values to the queue after some have been deleted, can you help in this...?

Thanks Ian

#include<iostream.h><br />
class Queue<br />
{<br />
private:<br />
    int data[10];//maximum length of queue<br />
    int length;<br />
    int first;<br />
    int last;<br />
public:<br />
    Queue(int);<br />
    void push(int);<br />
    int pop();<br />
	void show();<br />
<br />
};<br />
// sets the size of the queue and both first and last to -1<br />
Queue::Queue(int len)<br />
{<br />
    length=len;<br />
    first=-1;<br />
    last=-1;<br />
}<br />
/* Function to pop (delete) the first student in the queue<br />
if the queue has any data in it*/<br />
int Queue::pop()<br />
{<br />
 int deleted;<br />
    if(first == -1) <br />
    {<br />
        return (0);<br />
    }<br />
    deleted=data[first]; <br />
    if(first==last)<br />
    {<br />
        first=-1;<br />
        last=-1;<br />
    }<br />
    else<br />
    first++;<br />
    return deleted;<br />
}<br />
<br />
/* Dispalys the menu allowing incorrect data entered<br />
to display an error message and re-show thr menu*/<br />
int menu()<br />
{<br />
    int choice = 0;<br />
    cout<<"\n\n\t\t**MAIN MENU**";<br />
    cout<<"\n\n\t1\tStudent number to join the queue";<br />
    cout<<"\n\t2\tStudent seen (Remove from queue)";<br />
    cout<<"\n\t3\tView the students in the queue";<br />
	cout<<"\n\t4\tEXIT";<br />
    cout<<"\n\n\tPlease enter your choice : ";<br />
    cin>>choice;<br />
    return choice;<br />
}<br />
/* Inserts the StudentID and shows message if <br />
the queue is full*/<br />
void Queue::push(int out)<br />
{<br />
    if(last == length - 1) <br />
    {<br />
        cout<<"\tSorry the queue is full, please wait";<br />
        return;<br />
    }<br />
    if(first == -1)<br />
    {<br />
        first=0;<br />
    }<br />
    last=last+1;<br />
    data[last]=out; <br />
    return;<br />
}<br />
<br />
void Queue::show()<br />
{<br />
<br />
}<br />
<br />
//The choice of menu options are executed<br />
void main()<br />
{<br />
<br />
	int StudentID;<br />
    int number;<br />
    int option;<br />
    cout<<"\n\n\tEnter the length of the Queue : ";<br />
    cin>>number;<br />
	while (number>10)<br />
	{<br />
		cout<<"\nMaximum length of queue is set to 10, try again: ";<br />
		cin>>number;<br />
	}<br />
    Queue place(number);<br />
    do<br />
    {<br />
        option = menu();<br />
        switch(option)<br />
        {<br />
            case 1:<br />
<br />
			cout<<"\n\t* * Valid student numbers between 1 and 500 only * *\n";<br />
			cout<<"\nEnter the student number : ";<br />
            cin>>StudentID;<br />
			while (StudentID <1 || StudentID>500)<br />
			{<br />
				cout<<"Invalid entry try again";<br />
				cin>>StudentID;<br />
			}<br />
			place.push(StudentID);<br />
            cout<<"\n\tStudent number "<<StudentID<<" has been inserted into queue.";<br />
			break;<br />
            <br />
			case 2:<br />
            int StudentID;<br />
            StudentID=place.pop();<br />
            if(StudentID==0)<br />
            {<br />
                cout<<"\n\tSorry no students to see the queue is empty";<br />
            }<br />
            else<br />
            {<br />
                cout<<"\n\tStudent "<<StudentID<<" deleted from queue.";<br />
            }<br />
            break;<br />
			case 3:<br />
			break;<br />
            case 4:<br />
            {};<br />
            break;<br />
            default: cout<<"\nIncorrect entry, try again with 1,2,3 or 4.";<br />
        }<br />
    }<br />
    while (option!=4);<br />
}

GeneralRe: Queue help Pin
Christian Graus1-Dec-02 12:56
protectorChristian Graus1-Dec-02 12:56 
GeneralRe: Queue help Pin
Dudi Avramov1-Dec-02 5:21
Dudi Avramov1-Dec-02 5:21 
GeneralRe: Queue help Pin
geo_m1-Dec-02 8:20
geo_m1-Dec-02 8:20 
GeneralRe: Queue help Pin
Christian Graus1-Dec-02 12:57
protectorChristian Graus1-Dec-02 12:57 
GeneralRe: Queue help Pin
geo_m1-Dec-02 13:24
geo_m1-Dec-02 13:24 
GeneralRe: Queue help Pin
Christian Graus1-Dec-02 13:28
protectorChristian Graus1-Dec-02 13:28 
GeneralRe: Queue help Pin
geo_m1-Dec-02 13:55
geo_m1-Dec-02 13:55 
GeneralRe: Queue help Pin
Christian Graus1-Dec-02 14:01
protectorChristian Graus1-Dec-02 14:01 
GeneralRe: Queue help Pin
ian_ok1-Dec-02 8:52
ian_ok1-Dec-02 8:52 
GeneralRe: Queue help Pin
Christian Graus1-Dec-02 12:59
protectorChristian Graus1-Dec-02 12:59 
GeneralRe: Queue help Pin
ian_ok2-Dec-02 3:29
ian_ok2-Dec-02 3:29 
GeneralRe: Queue help Pin
Gary R. Wheeler3-Dec-02 15:12
Gary R. Wheeler3-Dec-02 15:12 
GeneralLink errors with GDI+ Pin
Salvador Dali1-Dec-02 3:58
Salvador Dali1-Dec-02 3:58 
GeneralRe: Link errors with GDI+ Pin
Michael Dunn1-Dec-02 5:41
sitebuilderMichael Dunn1-Dec-02 5:41 
GeneralRe: Link errors with GDI+ Pin
Salvador Dali1-Dec-02 10:41
Salvador Dali1-Dec-02 10:41 
GeneralHelp with Buffers! Pin
Paddy1-Dec-02 2:09
Paddy1-Dec-02 2:09 
GeneralRe: Help with Buffers! Pin
markkuk1-Dec-02 2:37
markkuk1-Dec-02 2:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.