Re: [algogeeks]

2011-10-08 Thread SHIVAM AGRAWAL
k got it thnx a lot.

On Sat, Oct 8, 2011 at 4:35 PM, shady  wrote:

> 1. don't use dev c
> 2. search archives
> 3. after doing 2 you will say it is not there,
> therefore solution by sunny -
>
> char five[7] -> string of length 7
> charlie -> 7 length string
>
> declare it as char[8] u will get expected output
>
> On Sat, Oct 8, 2011 at 4:14 PM, SHIVAM AGRAWAL  wrote:
>
>> when i am running this on dev c it is printing times but on running in
>> linux it is not printing times plz any1 xplain me y is it so
>>
>>
>> #include
>> main()
>>  {
>> char outline[50];
>> char one[7],two[7],four[7],five[7];
>> int three;
>> sprintf(outline,"this is %d tim %s \n",10,"charlie");
>> printf("%s",outline);
>> sscanf(outline,"%s %s %d %s %s",&one,&two,&three,&four,&five);
>> printf("%s\n",one);
>> printf("%s\n",two);
>> printf("%d\n",three);
>> printf("%s\n",four);
>> printf("%s\n",five);
>> }
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks]

2011-10-08 Thread SHIVAM AGRAWAL
when i am running this on dev c it is printing times but on running in linux
it is not printing times plz any1 xplain me y is it so


#include
main()
{
char outline[50];
char one[7],two[7],four[7],five[7];
int three;
sprintf(outline,"this is %d tim %s \n",10,"charlie");
printf("%s",outline);
sscanf(outline,"%s %s %d %s %s",&one,&two,&three,&four,&five);
printf("%s\n",one);
printf("%s\n",two);
printf("%d\n",three);
printf("%s\n",four);
printf("%s\n",five);
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] explain the output please.....

2011-10-07 Thread SHIVAM AGRAWAL
#include
main()
{
char c=-64;
int i=-32;
unsigned int u =-16;
if(c>i)
{
printf("pass1");
if(chttp://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Min no of moves

2011-09-04 Thread SHIVAM AGRAWAL
There are 2n glasses standing next to each other in a row, the first n of
them are filled with
a soda drink, while the remaining n glasses are empty. Make the glasses
alternate in a filledempty-
filled-empty pattern in the minimum no of glass moves.


my soln is start with 2nd and (n+2)th swap them
and then move to 4th and n+4th  this is to be
done n/2 times.total swaps are n/2  .. and
total moves n/2*2  ie n...


mine is n moves ...any1 with some better answer ???

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: FREQUENCY COUNT FOR TIME

2011-09-04 Thread SHIVAM AGRAWAL
any1  ??

On Sun, Sep 4, 2011 at 3:12 PM, SHIVAM AGRAWAL  wrote:

> Calculate frequency count for time for the
> following.
>
>
> #include
> #include
> using namespace std;
>
> int main()
> {
> ifstream filein;
> filein.open("datafile.dat",ios::in);
> int a[100];
> int j,k=0,h;
> filein >> j;
> while (filein){
> a[k]=j;
> k++;
> filein >> j;
> }
> filein.close();
> system("pause");
> return 0;
> }
>
> explain the output plz
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] FREQUENCY COUNT FOR TIME

2011-09-04 Thread SHIVAM AGRAWAL
Calculate frequency count for time for the
following.


#include
#include
using namespace std;

int main()
{
ifstream filein;
filein.open("datafile.dat",ios::in);
int a[100];
int j,k=0,h;
filein >> j;
while (filein){
a[k]=j;
k++;
filein >> j;
}
filein.close();
system("pause");
return 0;
}

explain the output plz

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] OUTPUT????

2011-08-06 Thread SHIVAM AGRAWAL
any1 plz tell me y output of float type of dis prgrm  is zero?

#include
#define INT 1
main()
{
struct a
{
int type;
};
struct c
{
int type;
int e;
};
struct b
{
int type;
float f;
};
union
{
struct a n;
struct b nf;
struct c ni;
}all;
all.ni.type=INT;
all.nf.f=10.43;
all.ni.e=1;
printf("%f\n",all.nf.f);
if(all.nf.type==INT)
printf("float value =%2.1f",all.nf.f);
if(all.ni.type==INT)
printf("\ninteger value=%d",all.ni.e);
printf("\n%d %d %d %f",all.ni.type,all.nf.type,all.ni.e,all.nf.f);

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2011-07-31 Thread SHIVAM AGRAWAL
yupthnx

On Sun, Jul 31, 2011 at 12:28 PM, rajeev bharshetty wrote:

> scanf returns the number of characters scanned as input,in here the scanf
> statement gets placed at getchar and hence since it accepts 1 character 'c'
> will print the value 1.
>
> #ifdef getchar checks for whether getchar is defined if defined it
> undefines it as #undef
> else
> it #define getchar as scanf // this statement actually runs .
> hence the output is 1 , characters accepted by the scanf .
>
> Hope you understood
>
>
> On Sun, Jul 31, 2011 at 12:00 PM, SHIVAM AGRAWAL wrote:
>
>> i got it....
>>
>>
>> On Sun, Jul 31, 2011 at 11:08 AM, SHIVAM AGRAWAL wrote:
>>
>>> plz xplain y it is printing zero ...means how dis prgrm is wrkng step by
>>> step
>>>
>>>
>>> On Sun, Jul 31, 2011 at 11:03 AM, rajeev bharshetty <
>>> rajeevr...@gmail.com> wrote:
>>>
>>>> *#include*
>>>> *#ifdef getchar*
>>>> *#undef getchar*
>>>> *#else*
>>>> *#define getchar scanf("%c",&ch);*
>>>> *#endif*
>>>> *main()*
>>>> *{*
>>>> *char ch;*
>>>> *int c;*
>>>> *c=getchar;*
>>>> *printf("%d",c);*
>>>> *}*
>>>>
>>>> This above code works as expected ....
>>>>
>>>> On Sun, Jul 31, 2011 at 11:02 AM, rajeev bharshetty <
>>>> rajeevr...@gmail.com> wrote:
>>>>
>>>>> Above Program is showing error on gcc compiler
>>>>>
>>>>> *ms52.c: In function ‘main’:*
>>>>> *ms52.c:11:19: error: expected expression before ‘)’ token*
>>>>>
>>>>> Check the code ...
>>>>>
>>>>> On Sun, Jul 31, 2011 at 10:59 AM, SHIVAM AGRAWAL 
>>>>> wrote:
>>>>>
>>>>>> can any xplain me d output and working of dis code...
>>>>>> #include
>>>>>> #ifdef getchar
>>>>>> #undef getchar
>>>>>> #else
>>>>>> #define getchar scanf("%c",ch);
>>>>>> #endif
>>>>>> main()
>>>>>> {
>>>>>> char ch;
>>>>>> int c;
>>>>>> c=getchar();
>>>>>> printf("%d",c);
>>>>>> }
>>>>>>
>>>>>>  --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Algorithm Geeks" group.
>>>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to
>>>>>> algogeeks+unsubscr...@googlegroups.com.
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Regards
>>>>> Rajeev N B <http://www.opensourcemania.co.cc>
>>>>>
>>>>> "*Winners Don't do Different things , they do things Differently"*
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Regards
>>>> Rajeev N B <http://www.opensourcemania.co.cc>
>>>>
>>>> "*Winners Don't do Different things , they do things Differently"*
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Rajeev N B <http://www.opensourcemania.co.cc>
>
> "*Winners Don't do Different things , they do things Differently"*
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2011-07-30 Thread SHIVAM AGRAWAL
plz xplain y it is printing zero ...means how dis prgrm is wrkng step by
step

On Sun, Jul 31, 2011 at 11:03 AM, rajeev bharshetty wrote:

> *#include*
> *#ifdef getchar*
> *#undef getchar*
> *#else*
> *#define getchar scanf("%c",&ch);*
> *#endif*
> *main()*
> *{*
> *char ch;*
> *int c;*
> *c=getchar;*
> *printf("%d",c);*
> *}*
>
> This above code works as expected 
>
> On Sun, Jul 31, 2011 at 11:02 AM, rajeev bharshetty 
> wrote:
>
>> Above Program is showing error on gcc compiler
>>
>> *ms52.c: In function ‘main’:*
>> *ms52.c:11:19: error: expected expression before ‘)’ token*
>>
>> Check the code ...
>>
>> On Sun, Jul 31, 2011 at 10:59 AM, SHIVAM AGRAWAL wrote:
>>
>>> can any xplain me d output and working of dis code...
>>> #include
>>> #ifdef getchar
>>> #undef getchar
>>> #else
>>> #define getchar scanf("%c",ch);
>>> #endif
>>> main()
>>> {
>>> char ch;
>>> int c;
>>> c=getchar();
>>> printf("%d",c);
>>> }
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards
>> Rajeev N B <http://www.opensourcemania.co.cc>
>>
>> "*Winners Don't do Different things , they do things Differently"*
>>
>>
>
>
> --
> Regards
> Rajeev N B <http://www.opensourcemania.co.cc>
>
> "*Winners Don't do Different things , they do things Differently"*
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2011-07-30 Thread SHIVAM AGRAWAL
i got it

On Sun, Jul 31, 2011 at 11:08 AM, SHIVAM AGRAWAL  wrote:

> plz xplain y it is printing zero ...means how dis prgrm is wrkng step by
> step
>
>
> On Sun, Jul 31, 2011 at 11:03 AM, rajeev bharshetty 
> wrote:
>
>> *#include*
>> *#ifdef getchar*
>> *#undef getchar*
>> *#else*
>> *#define getchar scanf("%c",&ch);*
>> *#endif*
>> *main()*
>> *{*
>> *char ch;*
>> *int c;*
>> *c=getchar;*
>> *printf("%d",c);*
>> *}*
>>
>> This above code works as expected 
>>
>> On Sun, Jul 31, 2011 at 11:02 AM, rajeev bharshetty > > wrote:
>>
>>> Above Program is showing error on gcc compiler
>>>
>>> *ms52.c: In function ‘main’:*
>>> *ms52.c:11:19: error: expected expression before ‘)’ token*
>>>
>>> Check the code ...
>>>
>>> On Sun, Jul 31, 2011 at 10:59 AM, SHIVAM AGRAWAL wrote:
>>>
>>>> can any xplain me d output and working of dis code...
>>>> #include
>>>> #ifdef getchar
>>>> #undef getchar
>>>> #else
>>>> #define getchar scanf("%c",ch);
>>>> #endif
>>>> main()
>>>> {
>>>> char ch;
>>>> int c;
>>>> c=getchar();
>>>> printf("%d",c);
>>>> }
>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algogeeks@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com.
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>
>>>
>>> --
>>> Regards
>>> Rajeev N B <http://www.opensourcemania.co.cc>
>>>
>>> "*Winners Don't do Different things , they do things Differently"*
>>>
>>>
>>
>>
>> --
>> Regards
>> Rajeev N B <http://www.opensourcemania.co.cc>
>>
>> "*Winners Don't do Different things , they do things Differently"*
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks]

2011-07-30 Thread SHIVAM AGRAWAL
can any xplain me d output and working of dis code...
#include
#ifdef getchar
#undef getchar
#else
#define getchar scanf("%c",ch);
#endif
main()
{
char ch;
int c;
c=getchar();
printf("%d",c);
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.