simple c++ program for "abcde123ba" convert "ab321edcba"
with out using string
Answers were Sorted based on User's Feedback
Answer / prasenjit roy
#include "stdio.h"
int main(int argc, char* argv[])
{
char sBuffer[]="abcde123ba";
char sBuff[100];
char *pStr = sBuffer;
int i;
puts(sBuffer);
while(*pStr != '\0')
++pStr;
for ( i = 0; pStr != sBuffer; i++,pStr--)
sBuff[i] = pStr[-1];
sBuff[i] = '\0';
puts(sBuff);
return 0;
}
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / pramod
void mystrrev(char* str)
{
char ch;
int last=strlen(str)-1;
for(int i=0;i<last;i++,last--)
{
ch=str[i];
str[i]=str[last];
str[last]=ch;
}
}
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / ragavan
#include<stdio.h>
#include<conio.h>
//Using recursive
void print( char c)
{
char a;
if(c=='\n')
return;
a=getchar();
print(a);
printf("%c",c);
return;
}
void main()
{
char c;
clrscr();
c= getchar();
print(c);
getch();
}
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / abdelrhman matter
#include<iostream>
using namespace std;
int main ()
{
cout<<" insert Any number and i will switch it : ";
int num; cin>>num;
do
{
cout<<num%10;
num = num/10;
}while(num>0);
cout<<endl;
return 0;
}
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sandeep
#include<iostream.h>
#include<string.h>
int main()
{
char a='abcde123ba';
strrev(a);
cout<<a;
getch();
return 0;
}
Is This Answer Correct ? | 2 Yes | 11 No |
Write about the role of c++ in the tradeoff of safety vs. Usability?
What c++ is used for?
How does a C++ structure differ from a C++ class?
this is to swap to strings....but in output the whole strings are swapped leaving first as it is...why it is so #include<iostream.h> int main() { char a[]="ajeet"; char b[]="singh"; long x=*a; long y=*b; cout<<x<<":"<<y; x=x+y; y=x-y; x=x-y; *a=x; *b=y; cout<<x<<":"<<y; cout<<&a<<endl; cout<<&b<<endl; }
Please explain class & object in c++?
How to detect memory leaks in c++
What is the use of vtable?
What is a class template in c++?
What is ios in c++?
Mention the ways in which parameterized can be invoked. Give an example of each.
Tell me difference between constant pointer and pointer to a constant.
What are the types of pointer?