in case of single map, to see whether a key exists or not mapname.count(keytofind) is used
map<int,bool>rb;
map<int,bool>::iterator rb_it;
rb.insert(make_pair(5,true));...
Type: Posts; User: howhy
in case of single map, to see whether a key exists or not mapname.count(keytofind) is used
map<int,bool>rb;
map<int,bool>::iterator rb_it;
rb.insert(make_pair(5,true));...
i want to implement sparse graph in c\c++.
i need help regarding it.
is there any builtin sparse graph in STL?
or any kind of help that STL can provide regarding this?
any help will be...
lydiapeter says
No, there is no way to do that....
when dynamically allocating memory, default ctor will be called for each object.
Yes, there is a way to do what u require..
that is...
myclass *obj=new myclass[5];
when dynamicaly allocating memory for an array of objects,
default ctor will be called for each object.
there is no way to call another ctors.
because other...
i got it......................
try to understand what i mean........
ok, i am rephrasing my question...
typedef struct temp
{
int data;
}T;
laserlight
i know there are uses of pointer to pointer, but i mean specially here where the purpose is solved by just pointer.
my question is
when i am calling setframe3(tp);
and then...
My question is
what is the use of pointer to pointer ,if purpose is solved by just a pointer???
like
when i call setframe2(&tp); i am passing address of pointer
void setframe2( T...
Firstly see the code:
#include<iostream>
#include<conio.h>
using namespace std;
typedef struct temp
{
int data;
} T;
Salem
done, but no difference in output.
i think c++ will close the outfile automatically when the dtor will be called.
any way i tried it, but no difference in output.
Latest Code:
#include<iostream>
#include<fstream>
#include<conio.h>
void main()
{
char ch;
Salem says
yeah, that was imp,
thanks for reminding.
salem
i checked it, it does not matter.
well,
this is very imp info regarding memory leaks.
thanks for this.
and keep it up.
new lines of code added in bold
void main()
{
...................
.................
................
..................
!outfile.is_open() tried
same ouput
???????????????
This is my program for printing a file using c++ program.
This gets complied and linked properly.
but when i run it , then it does not print anything.
its OUTPUT
Input file opened
OUTPUT...
Ken Fitlike says
Another option is to use an unnamed namespace.
well,
this is my code, it is working fine with static.
but i would like to know how to do it using unnamed namespace.
Thanks Salem :-)
Actually i knew abt this fact of static.
but still , i was not sure.
and i just wanted to confirm.
soooo....
thanks again.
how to make a variable in file scope.
I mean
it should not be local to a function.
and it should not be global ( available to other source files).
it should be availble only in the current...