473,320 Members | 2,098 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

help me to solve problem in C++

Hello friends,
I am having problem while running below program.

If anyone can help me....

// create class car
#include<conio.h>
#include<iostream.h>
#include<stdio.h>
// class declaration
class car
{
//data member
private:
char *c_nm;
char *color;

int model;
float price;

//member function
public:
void getcar(int n,char *nm,float p)
{
model=n;
c_nm=nm;
color=c;
price=p;
}
void putcar()
{
cout<<endl<<"model :="<<model;
cout<<endl<<"name :="<<c_nm;
cout<<endl<<"color :="<<color;
cout<<endl<<"price :="<<price;
}
};
void main()
{

int i;
char *nm1;
char *c1;
float p1;
clrscr();

car c11; //object of class
cout<<"enter model:=";
cin>>i;
cout<<"enter name:=";
cin>>nm1;

cout<<"enter color:=";
cin>>c1;
cout<<"enter price:=";
cin>>p1;

c11.getcar(i,nm1,p1);
c11.putcar();
getch();
}
Aug 4 '08 #1
3 1680
gpraghuram
1,275 Expert 1GB
Firstly, dont use iostream.h...instead use iostream and using namespace std; for that

There are few simple compiler issues...
Try solving that


Raghu
Aug 4 '08 #2
JosAH
11,448 Expert 8TB
If anyone can help me....
Care to tell *what* actually is wrong? Doesn't it compile? Doesn't it do what it's
supposed to do? Does it crash? Or do you want us to guess? Are deamons
flying out of your nose?

kind regards,

Jos
Aug 4 '08 #3
weaknessforcats
9,208 Expert Mod 8TB
One problem you are having is that your class data membewrs are pointers but you do not appear to be allocating any memory for them to point at.
Aug 4 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: the_proud_family | last post by:
HELP ME PLEASE!! my email is the_proud_family@yahoo.com I can't get the ball to go up right side and then I need it to turn around and keep turning until velocity=0 I have been at it for the ...
2
by: QH Hong | last post by:
Compilation of the folowing program gives error message error C2664: 'solve' : cannot convert parameter 1 from 'double (double)' to 'double (__cdecl *)(double)' Here's the codes ==== class...
15
by: Alfonso Morra | last post by:
Hi, I have some code from an example, that I want to retrofit into my project. The code from the example has the following line: SharedAppenderPtr myAppender( new...
1
by: Tito Brezovacki via .NET 247 | last post by:
Hi. The problem is very simple to describe, but tough to solve :( I have a printer that doesn't print on win98 using the usualprocedures (print() in C#) . I could barely get it to work on xpby...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
8
by: SanjaiGandhi | last post by:
Hi ...i am new to programing....pls help to overcome this program.. The Program is..: if a = 557..using for loop or while or dowhile ..we have to get the answer for 5+5+7..that is what ever...
6
by: Kyote | last post by:
I'm trying to make, what I thought, would be a simple application. This application will help me organize files I have a lot of, on my computer(ebooks, pictures, etc..). I'm currently dealing with...
3
by: Dew | last post by:
Hello, iam new to programming, and ive been given a task in my Uni to complete certain exercises but i found it very difficulty to solve them. I was wandering if there is someone who can help me...
3
by: deanchhsw | last post by:
Hello, I'm trying to build a program that solves sudokus and prints out the result on the screen. Here's the code for the class SudokuBoard. this will later be called in a class Sudoku. I'm a newbie,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.