I dont know
Printable View
I dont know
Didn't your instructor cover strings in class? What implementation did he/she describe to you?Quote:
Originally Posted by Mugilan
Get a book for C++ beginners.
It sounds like you never went to any of the classes. Nobody is going to do your homework for you. How are you suppose to learn if don't try to do it.
what is a default constructor ? how are an object's data members initialized if a class has only implicitly defined default constructor? explain the purpose of data member...........
anyone can tell me.....where i can get answers for this....
You normally learn that in the course. But it seems that you were playing truant. In that case I would take Jim's advice and get a book.Quote:
Originally Posted by Mugilan
i am not playing truant.........i am new to this...... i am taking diploma in IT, the class is just started about 2 weeks ago....
i write a program.......
#include<iostream>
using namespace std;
class employee
{
string first;
string last;
int salary;
public:
void getdata(void);
void setdata(void);
employee()
{
salary = 0;
last;
first;
}
};
int main()
{
void employee::getdata(void)
{
cout<<"a first name:";
cout<<"a last name:";
cout<<"monthly salary:";
}
void employee::setdata(void)
{
cout<<"first name";<< <<"\n";
cout<<"last name";<< <<"\n";
cout<<"monthly salary";<< <<"\n";
}
return 0;
}
but still got 2 error.......can anybody help me
.cpp(24): error C2601: 'employee::getdata' : local function definitions are illegal
.cpp(31): error C2601: 'employee::setdata' : local function definitions are illegal
You have to put this (above) in the end. Out of the main() function.Quote:
Originally Posted by Mugilan
Google C++ tutorials.
Read them slowly and carefully.
Take your time.
Understand what is data delcaration, functions, arrays and pointers.
Then get on to OOPS concepts and classes.
All the Best
#include<iostream>
#include<string>
using namespace std;
class employee
{
string first;
string last;
int salary;
public:
void getdata(void);
void setdata(void);
employee()
{
salary = 0;
last = " ";
first = " ";
}
};
void employee::getdata(void)
{
cout<<"\n a first name:"<<first;
cout<<"\n a last name:"<<last;
cout<<"\n monthly salary:"<<salary;
}
void employee::setdata(void)
{
cout<<"first name?:";
cin>>first;
cout<<"last name?:";
cin>>last;
cout<<"monthly salary?:";
cin>>salary;
}
int main()
{
employee E;
E.setdata();
cout<<"\n yearly salary:\n";
E.getdata();
return 0;
}
using this program how to do this......create two employee objects and display each object's yearly salary.the give each employee a 10 percent raise and display each employee's yearly salary again.
can anybody help me on this question.............................................
wrte a program that prits the power of the integer 2, namely 2, 4, 8 , 16, 32, 64, etc. your while loop should not terminate (i.e..you should create an infinite loop). to do this simply use the keyword true as the expression for while statement. what happens when you ru this program?
can anybody please help me on this
wt u want exactly????
U want program ?
OR
wt happens if we run that program?
The whole idea of taking a diploma in IT is FOR YOU TO LEARN. Your instructor will have already covered what you need for this homework or will at least have given references to books. Pay attention, read the references and other supplied material and if you still don't understand tell him. We've already done our homework and can better spend our time helping others who show signs of helping themselves. You're showing absolutely no signs that you've made any effort at all. Why should we help?
On a different point not related to this. I express the same views regarding the Indian sub-continent's request to do their IT outsourcing work for them.
This is a forum for professionals and would-be profesionals. Not a "do my homework for me" and "write my outsourcing project for me" forum.
I apologise in advance if I upset some members but this forum is cluttered with such requests and I'm getting a little tired of it (as I suspect are some other members).
Mugilan..what is ur age??
do u go to school or college??
we all will be very happy to see u urself doing ur home work..
this site is to help someone who has a query..!!!
Take it positively
:)
ProElite
write a program