CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2013
    Location
    islambad
    Posts
    1

    plz help me i have a error C2059: syntax error : 'PCH creation point' in my code

    header file:
    class node
    {
    public:
    int data;
    node * next;
    int get()
    {
    return data;
    }
    void set()
    {
    cout<<"\nEnter the Value : ";
    cin>>data;
    }
    node *getnext()
    {
    return next;
    }
    void setnext(node *newnode)
    {
    this->next=newnode;
    }
    node()
    {
    data=0;
    next=NULL;
    }
    };
    class linklist
    {
    public:
    node *hn;
    node *CN;
    node *LCN;
    public:
    linklist()
    {
    LCN=NULL;
    hn=NULL;
    CN=NULL;
    }
    void inputdata()
    {
    node *newnode=new node();
    newnode->set();
    if(hn==NULL)
    {
    newnode->setnext(NULL);
    hn=newnode;
    LCN=hn;
    CN=newnode;
    }
    else
    {
    newnode->setnext(NULL);
    CN->setnext(newnode);
    LCN=CN;
    CN=newnode;
    }
    }
    void showdata()
    {
    int w=1;
    node *tmp;
    tmp=hn;
    while(tmp!=NULL)
    {
    cout<<endl<<w<<"."<<tmp->get();
    tmp=tmp->getnext();
    w++;
    }
    }

    void replacedata()
    {
    int f3=0;
    node *t3;
    inta,b;
    cout<<"\nEnter new value : ";
    cin>>a;
    t3=hn;
    while(t3!=NULL)
    {
    if(t3->get()==a)
    {
    b=a;
    t3->set();
    cout<<"old Value = "<<b<<"\nNew Value = "<<t3->get();
    f3++;
    }
    t3=t3->getnext();
    }
    if(f3==0)
    {
    cout<<"\n no value found!!!!!!!!!!! "<<endl;

    }

    int deletdata(int no)
    {
    node *t4,*prev;
    t4=hn;
    while(t4!=NULL)
    {
    if(t4->get()==no)
    {
    if(t4==hn)
    {
    hn=t4->getnext();
    delete t4;
    return 1;
    }
    else
    {
    prev->next=t4->next;
    delete t4;
    return 1;
    }
    }
    else

    {
    prev=t4;
    t4=t4->getnext();

    }
    }
    return 0;
    }
    };
    ---------.cpp file-----------
    #ifndef a_h
    #define a_h
    #include<stdio.h>
    #include<iostream.h>
    #include "c.h"
    void main()
    {
    linklist l;
    int i=0,ch=0,n;
    char choice;
    cout<<"_____________ ***MAIN MENU***_____________"<<endl;
    cout<<"1.Insert Data"<<endl;
    cout<<"2.Show Data"<<endl;
    cout<<"3.Retrieve Data"<<endl;
    cout<<"4.Replace"<<endl;
    cout<<"5.Delete"<<endl;
    cout<<"Enter Your Choice : ";
    cin>>ch;
    switch(ch)
    {
    case 1:
    {
    do
    {
    l. inputdata();
    i++;
    cout<<"\nDo You Want To continue(y/n)? ";
    cin>>ch1;
    }
    while(ch1!='N' && ch1!='n');
    }
    break;
    case 2:
    {
    if(i==0)
    {
    cout<<"enter data first "<<endl;
    }
    else
    {
    l. showdata();
    }
    }
    break;
    case 3:
    {
    if(i==0)
    {
    cout<<"enter data first "<<endl;
    }
    else
    {
    l.search();
    }
    }
    break;
    case 4:
    {
    if(i==0)
    {
    cout<<"enter data first. "<<endl;
    }
    else
    {
    l. replacedata();
    }
    }
    break;
    case 5:
    {
    if(i==0)
    {
    cout<<"enter data first. "<<endl;
    }
    else
    {
    cout<<"\nEnter The Value To Be Delete : ";
    cin>>n;
    if(l.deletdata(n)==1)
    {
    cout<<"Value Will Be Deleted"<<endl;
    i--;
    }
    else
    cout<<"No Such Value Find!!!!! "<<endl;
    }
    }
    break;
    }
    }

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: plz help me i have a error C2059: syntax error : 'PCH creation point' in my code

    Before posting code, please format properly. Also use code tags for the code. As posted the code is just about unreadable. Go Advanced, select the code and click '#'
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: plz help me i have a error C2059: syntax error : 'PCH creation point' in my code

    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured