Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 796863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:42:25+00:00 2026-05-14T22:42:25+00:00

Hey guys. Check out this piece of sample code. #include stdafx.h #include<conio.h> #include<string.h> class

  • 0

Hey guys. Check out this piece of sample code.

#include "stdafx.h"
#include<conio.h>
#include<string.h>

class person{
private char name[20];
private int age;

public void setValues(char n[],int a)
{
    strcpy(this->name,n);
    this->age=a;
}
public void display()
{
    printf("\nName = %s",name);
    printf("\nAge = %d",age);
}
};


int _tmain(int argc, _TCHAR* argv[])
{
person p;
p.setValues("ram",20);
p.display();
getch();
return 0;
}

I am getting the following errors :

1>—— Build started: Project: first, Configuration: Debug Win32 ——
1> first.cpp
1>c:\documents and settings\dark wraith\my documents\visual studio 2010\projects\first\first\first.cpp(9): error C2144: syntax error : ‘char’ should be preceded by ‘:’

1>c:\documents and settings\dark wraith\my documents\visual studio 2010\projects\first\first\first.cpp(10): error C2144: syntax error : ‘int’ should be preceded by ‘:’

1>c:\documents and settings\dark wraith\my documents\visual studio 2010\projects\first\first\first.cpp(12): error C2144: syntax error : ‘void’ should be preceded by ‘:’

1>c:\documents and settings\dark wraith\my documents\visual studio 2010\projects\first\first\first.cpp(17): error C2144: syntax error : ‘void’ should be preceded by ‘:’
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:42:26+00:00Added an answer on May 14, 2026 at 10:42 pm

    The syntax of declaring public and private is wrong. Unlike other languages, in C++ it should be

    class person{
    private: 
    char name[20];
     int age;
    public:
      void display();
    

    ….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys this is my html code: <div class=nakupy> <li class=icn_kategorie><a href=#>Nákupy</a> <div class=sub_menu>
Hey guys, check this out. I have a function that treats for me a
hey guys having this really simple problem but cant seem to figure out have
Hey guys.. Check out the fading grey on top of the page and the
Hey guys check this page . This page has fluid layout now. I applied
hey guys when I store this string: http://61.147.96.19/f4v/41/53283141.h264_2.f4v?10000&key=d7d7488b5dd4a35aac3e784cf4acb1a174ddc7&amp;playtype=1&amp;tk=2038443745&amp;brt=3&amp;id=tudou&amp;itemid=30165756&amp;fi=53283141&amp;sz=19354294 in a variable @longurl and use
Hey guys please check this page . Please visit the page using any browser
Hey guys was hoping you can help me out. been at this for like
Hey guys was hoping you could help me out. basically i'm working on a
hey guys was hoping you could help me out, Not sure if I always

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.