oops..i think my program terminates once i input a value to exit.
So therefore never saw my destructors.
any way to see the destructor being called?
Type: Posts; User: rahulsk1947
oops..i think my program terminates once i input a value to exit.
So therefore never saw my destructors.
any way to see the destructor being called?
Hi,my following code..the destructor never gets called !
#include <cstdlib>
#include <iostream>
#include <iomanip>
using namespace std;
class Base{
Hi, i got this program to book seats for a cinema show.if trying to book seats already booked,a exception is thrown.code is as follows.
try{
if(ifFoundBookedSeats==true){...
hi,i got the following code.it compiles welll.but when running,it gives a"debug assertion failed" error.
#include <iostream>
class test{
public:
char *fileName;
test(char *r){
hi, did this declaration for my virtual desctructor.it continues to give me this error:virtual outside class declaration using dev c++ compiler
#include <iostream>
using namespace std;
...
Hi, i got a destructor for a class Base1.
my syntax/format is wrong. can some-one correct it for me?
Base1::virtual ~Base1() {
cout << "Destroy Base" << endl;
}
class base{
private:
int x;
public:
base(){
x=4;
}
};
is it correct to do this? set x=4 in a default constructor? want'ed to set the initial value of...
i convereted it to:
derieved1*sb=dynamic_cast<derieved1*>(bbbb);
derieved2*sb1=dynamic_cast<derieved2*>(bbbb);
It gives me a error.
'dynamic_cast' : 'base' is not a polymorphic type
Hi,
i got a base class,and 2 derieved classes.derieved1 and derieved 2.
In the main class,i create a derieved1 and derieve2 object. add it to vector vector<base*> list .
Then i try casting...
i have developed a program.lot of text and numeric inputs.
input needs to be validated.
1) All the validation is done right after we read it in by cinn>> ?
2) There might be lot of...
thanks for reply.
my program was all the while acesing the vector by index only. and the find function uses iterators. i got redesign my program now.
# was my program design wrong of...
Hi,
i got a vector<int> of values 12,49,51,98
i wanted to search for value 12 and replace it with another value like 42.
is there any vector function to search and replace straight away?
...
Hi,
I got a class student.
And a vector<student> listOfStudents.
Wanted to ask,which is best way to store this vector.
vector<student> listOfStudents; //method A
vector<student*>...
eg: vector<int> listOfValues
Hi,
Vectors can be accessed by index like listOfVaules[9]
OR
by iterator.
which is the best way of accessing? is accessing by index a bad practice?
Thanks,
Hi,i got a method
void searchStaff(string staffID){
}
I want to write a comment on top to describe the method.
i did this:
Hi,
i got a class:
class base{
private:
int age;
public:
base(int);
};
I am writting a simply inheritance test program. Master class is dad class. class son and daughter is derieved from dad.
my code :
dad.h
#include <iostream>
using namespace std;
class dad{...
I want to tokenise a string(in string format) base on specified delimiters.
void getTokens(char str[],char delims[]){
char *result = NULL;
result = strtok( str, delims );
...
Hi,
i want to convert a string to char * or char[]
i tried:
string a="123";
char *b=a.c_str();
lets say i have base class a
and class b is inheriting class a.
in class a we have a function called convert().in convert we create a object of type b.
Is this correct?
It compiles and...
Hi,
i am writing a c program.want to check if it leaks memory.
I am compiling and runing on windows platform.Using the visual c++ toolkit compiler or the dev c++ compiler.Find them reliable.
...
Hi i got a program to store words and number of spaces after each word.
Words would be in a word node.the code is:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>...
HI,i was trying to do the following.I tried but cant figure out my error.I want the output to be 123.456
#include <stdio.h>
int main(void){
unsigned int a=123456;
double b=a/1000;
Hi,
i got a input text file,its data is as follows:
*the number dont exist in the input test file,added for reference only*
1. intial line
2. second line of file
3. hope you are having great...
thank you for your help.I have then proceeded to make it into a list of students.I get an error again.I dont know what wrongs
#include <stdio.h>
#include <stdlib.h> /* for malloc */
...