Sunday, August 2, 2009

C programe that can transger a string "Hello", to another connected computer. after receving "Hello, the rece

Your question is quite confusing! Can you rephrase your question?

C programe that can transger a string "Hello", to another connected computer. after receving "Hello, the rece
Are you talking about a C++ program ? Your question is confusing. However, you need to network two computers so that the C++ compiler can communicate with the other C++ compiler. You need to find out how to network computers


How do i make a program in c language that extracts the suffix of a word/string?

ex: String: Department


prefix: Depart


suffix: ment

How do i make a program in c language that extracts the suffix of a word/string?
try looking it on the web
Reply:Shouldn't you ask this in a different section? Most of us here know languages but not computer-programming.
Reply:I sincerely doubt that you'd be able to make a program which can truly capture the complexity of morphology. Just as internet translators are notoriously inadequate, a computer program would have to understand morphology like a human does, and so far I've seen very little evidence that this is possible.


C program to print a particular string for hundred times without any condition statements?

The following program would do the trick.


#include %26lt;stdio.h%26gt;





int c=101;


int f()


{


c=c-1;


c %26amp;%26amp; printf ("The string \t") %26amp;%26amp; f();


return 1;


}


void main()


{f();}





Hope this solves your problem.


-Regards, Rahul

C program to print a particular string for hundred times without any condition statements?
No conditional statements doesn not mean no loops ;)


FOR loop dude!


for (int i=0; i%26lt;399;i++)
Reply:Thats a stupid question. The only solution is to type printf("string"); 400 times.





You get no benefit. Use a damn for loop.
Reply:write this line hundred times


printf("Your string...");

pear

C program to find wheather the string is palindrome or not..friends please help!!?

we can do this using the string functions





#include%26lt;stdio.h%26gt;


main()


{


char a[20],b[20];


printf("enter a string");


scanf("%s",%26amp;a);


strcpy(b,a);//copies string a to b


strrev(b);//reverses string b


if(strcmp(a,b)==0)//compares if the original and reverse strings are same


printf("\n%s is a palindrome",a);


else


printf("\n%s is not a palindrome",a);


return 0;


}

C program to find wheather the string is palindrome or not..friends please help!!?
Hey thats an excellent trick of finding whether palindrome or not. Good. Keep going..... Report It

Reply:palindrome: It is a word, phrase, number or other sequence of units that has the property of reading the same in either direction.for example:"madam",it can be read in both the directions..


void main()


{


//first read a string A from the key-board using scanf().


// now reverse the given string and store the


//resultant in string C.compare strings A and C using string


//handling functions "strcmp".if it is true then print that string is


//palindrome else print that the string is not palindrome


}


C++: Changing a number into a string of chars?

How would I change an int variable which is 12345 into a char array with [1,2,3,4,5]?





Tell be the corresponding library please, if there is one.

C++: Changing a number into a string of chars?
Use sprintf.





char buf[32];


sprintf(buf, "%d", nValue);





where nValue is your int variable.
Reply:How about incorporating a straight c fix:





#include %26lt;stdio.h%26gt;


int yo = 12345;


char buf[30];


sprintf(buf, "%d", yo);





or if you use a char to hold initially 12345, then it is already in an array.





for(int i = 0; i %26lt; strlen(buf); i++)


printf("%c\n", buf[i]);


Getting input from a text file using c strings in c++?

How do i get input from a text file using c strings, not the standard string class. Is it possible?

Getting input from a text file using c strings in c++?
Sure, as long as you use the #include%26lt;fstream%26gt; header, and name the file you want to use as input. When you parse the data, just store it to a C-String, which as you should know is an array made exclusively of characters.


C program recursive method (find the character index in the string)?

str = "Hello world"


ch = "w"


use recursive method, no string.h function


return 'w' index = 6





int findIndexString(char str[ ], char ch)

C program recursive method (find the character index in the string)?
again, like before! I really hv too much time in my hands today :-p





#include %26lt;stdio.h%26gt;





int findIndexString(char str[], char ch) {


int pos;


if (*str=='\0') {


return -1;


}


if(*str==ch) {


return 0;


}


pos = findIndexString(++str, ch);


if (pos%26lt;0) {


return pos;


} else {


return pos+1;


}


}


int main() {


char str[25]="hello world";


int pos = findIndexString(str, 'h');


printf("The position is %d\n", pos);


}
Reply:Hello,





I suppose this is just for fun? If so, ok.





Else please note It is particularly inefficient to use recursiveness for such low level functions. You put the system under heavy strain due to call stack adjustments needed to accomodate the numerous function calls (passing variables).
Reply:int findIndexString(char str[],char ch)


{


static int i=0;


if(*str =='\0')


return 0;


else if(*str == ch)


return i;


else{


i++;


return findIndexString(++str,ch);


}





}

nobile