csurfer 422 Posting Pro

Your code snippet can be shortened tux...here it goes:

void reverse(char p[])
{
     int len=strlen(p);
     for(int i=len-1, j=0;j<i; i--, j++)
     {
          // exchange elements
          p[i]^=p[j]^=p[i]^=p[j];
     }
}

Try it and do tell me what do you think...???

csurfer 422 Posting Pro

Never done it before ? Very good try it now !!! Only then you will learn...

Well in C you would do something like :

FILE *f;
char str[100],*str1="file",*str2=".txt";
//You have count and file<count> is the file you want to open
sprintf(str,"%s%d%s",str1,count,str2);
f=fopen(str,"rw+");
//Go on with your writing work

Now try the same thing in C++.Try to implement it on your own.Only then can you learn something.

csurfer 422 Posting Pro

I think it means, read an integer as input from the user and assign it to the integer variable first_int.

int first_int;
scanf("%d",&first_int);

If you are still getting error, we need code and more detail to answer.

You think Ancient Dragon is so dumb that he couldn't give the simple answer you gave the OP ??? Just have a look at his reputation points and number of solved threads.
Its just the culture here to make people try and learn rather than given them the code well arranged in a golden platter.

I hope you being a part of the DANIWEB family now will help us carry this culture further and help people learn rather than giving them away the codes. :)

Salem commented: *nods* +36
Tom Gunn commented: Can you get any more extreme? It's a trivial 2 line snippet for god sake. No secrets of the programming elite were divulged here. Chill. -1
jephthah commented: lighten up. telling a beginner how to properly use 'slighten up, dude. instructing a beginner on how to use 'scanf' is hardly giving away trade secret. -2
csurfer 422 Posting Pro

Ever heard of GOOGLE ??? You get loads there...!!!

jephthah commented: come on man. lighten up a bit. and "google.co.in" ? really? -2