Click here to Skip to main content
15,916,846 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Multi doc/views and MDI Pin
Michael P Butler2-Nov-03 9:20
Michael P Butler2-Nov-03 9:20 
GeneralRe: Multi doc/views and MDI Pin
alex.barylski2-Nov-03 9:33
alex.barylski2-Nov-03 9:33 
GeneralC++ Pin
slgeorge52-Nov-03 7:39
slgeorge52-Nov-03 7:39 
GeneralRe: C++ Pin
Michael Dunn2-Nov-03 7:46
sitebuilderMichael Dunn2-Nov-03 7:46 
GeneralRe: C++ Pin
slgeorge52-Nov-03 7:48
slgeorge52-Nov-03 7:48 
GeneralRe: C++ Pin
David Crow3-Nov-03 5:35
David Crow3-Nov-03 5:35 
GeneralRe: C++ Pin
Phil Martin2-Nov-03 11:34
professionalPhil Martin2-Nov-03 11:34 
GeneralRe: C++ Pin
slgeorge52-Nov-03 12:13
slgeorge52-Nov-03 12:13 
Here is what I have so far: The error is coming up on the ConcanateString function.
Thanks

#include <iostream>

using namespace std;

struct Node
{
char item;
Node *next;
Node *prev;
Node *Tail;
};


class Newstring
{
public:
Newstring();//constructors
~Newstring();

void Append(char);
void ConcanateString(Newstring& Alist);
void Display();

private:
Node *Head;
Node *curr;
Node *prev;
Node *next;
Node *Tail;

};//end class

Newstring::Newstring()
{
Head = NULL;
curr = NULL;
prev = NULL;
next = NULL;
Tail = NULL;
}

Newstring::~Newstring()
{
Node *ptr;
while(Head!=NULL)
{
ptr=Head->next;
delete Head;
Head=ptr;
}
}
void Newstring::ConcanateString(Newstring& Alist)

{
Node *A = NULL;
Node *B = NULL;
A=Head;
B=Alist.Head;

if (A==NULL) {
A = B;
}
else {
curr = A;
while (curr->next != NULL) {
curr = curr->next;
}
curr->next=NULL;
curr->next = B;
}
B=NULL;
}

//Create strings
void Newstring::Append(char A)
{
Node *temp = NULL;

if (Head==NULL){
Head = new Node;
Head->item=A;
Head->next=curr;
}
else
{
curr=Head;

while(curr!=NULL)
{
prev=curr;
curr=curr->next;
}
temp=new Node;
temp->item=A;

temp->next=curr;
prev->next=temp;
}
}

//Display strings
void Newstring::Display()
{
if(Head==NULL)
{
cout << "List is empty" << endl;
return;
}
else
{
curr=Head;
while(curr!=NULL)
{
cout<< curr->item;
curr=curr->next;
}
cout << endl;
}
}

void main(){

Newstring String1, String2;


String1.Append('B');
String1.Append('a') ;
String1.Append('t') ;
String1.Display();
String2.Append('W');
String2.Append('i');
String2.Append('n');
String2.Append('g');
String1.ConcanateString(String2);
String1.Display();

}
GeneralRe: C++ Pin
Christian Graus2-Nov-03 12:17
protectorChristian Graus2-Nov-03 12:17 
GeneralRe: C++ Pin
slgeorge52-Nov-03 12:23
slgeorge52-Nov-03 12:23 
GeneralRe: C++ Pin
Christian Graus2-Nov-03 12:26
protectorChristian Graus2-Nov-03 12:26 
GeneralRe: C++ Pin
slgeorge52-Nov-03 12:31
slgeorge52-Nov-03 12:31 
GeneralRe: C++ Pin
Phil Martin2-Nov-03 12:22
professionalPhil Martin2-Nov-03 12:22 
GeneralRe: C++ Pin
slgeorge52-Nov-03 12:32
slgeorge52-Nov-03 12:32 
GeneralRe: C++ Pin
Christian Graus2-Nov-03 12:47
protectorChristian Graus2-Nov-03 12:47 
GeneralA splitter window without a divider Pin
DimkaSPB2-Nov-03 6:52
DimkaSPB2-Nov-03 6:52 
GeneralRe: A splitter window without a divider Pin
alex.barylski2-Nov-03 8:21
alex.barylski2-Nov-03 8:21 
QuestionHow to Messages from a new window Pin
ERKs2-Nov-03 6:01
ERKs2-Nov-03 6:01 
GeneralUsing Property Sheet within a PropertySheet Pin
Aamir Butt2-Nov-03 5:25
Aamir Butt2-Nov-03 5:25 
GeneralRe: Using Property Sheet within a PropertySheet Pin
Markyg2-Nov-03 15:13
Markyg2-Nov-03 15:13 
GeneralRe: Using Property Sheet within a PropertySheet Pin
Aamir Butt4-Nov-03 20:12
Aamir Butt4-Nov-03 20:12 
GeneralHello, embarrassing question about header files... Pin
Snyp2-Nov-03 4:18
Snyp2-Nov-03 4:18 
GeneralRe: Hello, embarrassing question about header files... Pin
Terry O'Nolley2-Nov-03 4:31
Terry O'Nolley2-Nov-03 4:31 
GeneralRe: Hello, embarrassing question about header files... Pin
Snyp2-Nov-03 4:45
Snyp2-Nov-03 4:45 
GeneralRe: Hello, embarrassing question about header files... Pin
Nick Parker2-Nov-03 5:11
protectorNick Parker2-Nov-03 5:11 

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.