Yes, I mean array of 3 strings.
Answer in C or C++ both are OK with me, because I am confident in both languages....
User Profile
Collapse
-
String Problem
Hello all,
this question was asked in an interview..
you have a string xCy consists only 'A' and 'B' , where x,C and y all are string but y is in reverse order of x,i.e., if x is 'ABAAB' then y should be 'BAABA'.
I was to find out whether a particular string is of the form of xCy or not. I could only access next character of string. ( so it was not possible to compare first element to last one, then second to second last and... -
I don't think so. As per my networking knowledge, computer will know MAC address of it's router not of my friend's situated at foreign....Leave a comment:
-
I am aware of set<> but I want to search algorithm better than O(n^2) and algorithm proposed is O(n^2). Cann't we make it better?...Leave a comment:
-
Finding Duplicate Elements
How to find more than one duplicate elements in array? ( One method is BST, but I want efficient method than it) -
Unpredictable Answer.
Hello All,
I was just trying to understand concept of float and double, when I write this code I got strange output:
Code:#include<iostream> using namespace std; int main() { float a; double b; a=0.7; b=0.7; if(a<0.7) cout<<"A"<<endl; else cout<<"B"<<endl; if(b<0.7)
-
Does MAC address necessary for packet delivery?
Hello all,
I am newbie in Networking. I have just started studying Networking.
I have a doubt
" Do every router/gateway determines physical address of other router or systems prior to the delivery of packets? If it is so then what is the need of IP address?"
Please help me to understand core networking concepts.
Thanx and regards,
Suyash.Upadhyay -
Unicode Support in C
Hello All,
I am involve in building a software which will manipulate hindi texts. I want to handle hindi text files in C. In unicode specification Hindi characters are supposed to take 4 bytes.
I tried to handle them using wchar_t but still I am getting error.
Can anyone please tell me how can I handle hindi characters or what is the correct format of using wchar_t?
Please Help Me.
Suyash -
It is not explicitly mentioned whether we can use pointers or not. I was also thinking to use pointers. Is there any other method possible?
Suyash...Leave a comment:
-
Reversing string without using indexing..
Hello all,
I encountered a programming problem while going through interview questions asked by companies. But I stuck at this:
Given an array of characters. How would you reverse it? How would you reverse it without using indexing in the array?
Please Help..
Suyash.. -
Thanx...
But I wanted to ask why this method is better because subtraction bears overhead like multiplication.
SuyashLeave a comment:
-
Fastest way to mulitply by 7
Hello all,
I got the answer that fastest way to multiply by 7 is n<<3 - n, but why?
If the question is to multiply by 8, then n<<3 is considerably better than n*8, because bitwise operation is faster. But when we multiply by 7, we are also subtracting n, it may be more cumbersome than multiplying directly with 7.
please answer,
Suyash -
Thanx Adrian,
But can you please tell me
Why extern int var; is declared and int var; is defined?
Thanx;
SuyashLeave a comment:
-
Difference between Declaration and Definition of a variable?
Hello all,
I am despondent to handle difference between declaration and definition of a variable. I have been totally confused.
Please help me,
Thanx in advance
Suyash -
Thanx for your reply,
But why it is necessary to use pointers:-
Following code produces same result upto some extent( till 4th-5th elements):-
[CODE=cpp]#include<iostre am>
using namespace std;
struct exp
{
int a[1];
};
int main()
{
struct exp s;
for(int i=0;i<4;i++)
s.a[i]=i;
cout<<endl;...Leave a comment:
-
C++ Puzzle
Hello all,
I got one question from my colleagues to answer.
The question is:
" How can I declare an array with only one element and still access elements beyond the first element (in a valid fashion)? "
But, I could not answer, Can anyone please help me to solve this problem?
Thanx in advance
Suyash -
Object Creation Problem
Hello All,
I was going through a very simple looking program, but as I am a newbie in C++ it created problem for me. I thought it will give compilation error but it went smoothly.
Code:#include<iostream> using namespace std; class sample { int i; public: sample(int ii) { i=ii; } }; class comp { sample s;
-
character constant is tool long of its type
Hello all,
I am getting warning with following line:-
wchar_t d=L'aa';
Warning : character constant is tool long of its type
Please help me to solve this problem..
Thanx
Suyash -
Handling .doc files
Hello All,
I am working on a project and I need to handle .doc files using C on Linux. But I am not getting any method how can I do so.
Can anyone give me any idea about it.
Thanx in advance. -
Puzzle
Hello All,
Why output of this program is 10 and 6. Please the reason.
main()
{
int x=1;
x=++x + ++x + ++x;
printf("%d\n",x );
x=1;
x=x++ + x++ + x++;
printf("%d\n",x );
}
Output:-
10
6
Thanx in advance
No activity results to display
Show More
Leave a comment: