Code for 1>"ascii to string"
2>"string to ascii"



Code for 1>"ascii to string" 2>"string to ascii"..

Answer / riz

#include <iostream>
using namespace std;
int main()
{
char word[32];
int x = 0;
cout << "Please enter the word (maximum 32 characters):\n";
cin >> word;
cout << "The ASCII for this word is:\n";
while (word[x] != '\0') // While the string isn't at the end...
{
cout << int(word[x]); // Transform the char to int
x++;
}
cout << "\n";
return 0;
}

Is This Answer Correct ?    16 Yes 0 No

Post New Answer

More C Code Interview Questions

main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }

2 Answers  


int main() { int x=10; printf("x=%d, count of earlier print=%d", x,printf("x=%d, y=%d",x,--x)); getch(); } ================================================== returns error>> ld returned 1 exit status =================================================== Does it have something to do with printf() inside another printf().

2 Answers  


main() { extern i; printf("%d\n",i); { int i=20; printf("%d\n",i); } }

1 Answers  


main() { register int a=2; printf("Address of a = %d",&a); printf("Value of a = %d",a); }

3 Answers  


main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit = (bit >> (i - (i -1)))); } } a. 512, 256, 128, 64, 32 b. 256, 128, 64, 32, 16 c. 128, 64, 32, 16, 8 d. 64, 32, 16, 8, 4

2 Answers   HCL,






main() { int i=5,j=10; i=i&=j&&10; printf("%d %d",i,j); }

1 Answers  


int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.

2 Answers   Bosch, eInfochips, HCL, IHCL,


write a c program to Create a registration form application by taking the details like username, address, phone number, email along with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 5 users and display the details. In place of password display “****”. (Use Structures).

0 Answers   CDAC, College School Exams Tests,


In a gymnastic competition, scoring is based on the average of all scores given by the judges excluding the maximum and minimum scores. Let the user input the number of judges, after that, input the scores from the judges. Output the average score. Note: In case, more than two judges give the same score and it happens that score is the maximum or minimum then just eliminate two scores. For example, if the number of judges is 5 and all of them give 10 points each. Then the maximum and minimum score is 10. So the computation would be 10+10+10, this time. The output should be 10 because 30/3 is 10.

0 Answers   TCS,


int i,j; for(i=0;i<=10;i++) { j+=5; assert(i<5); }

3 Answers   Cisco, HCL,


#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d..%d",*p,*q); }

1 Answers  


Implement a t9 mobile dictionary. (Give code with explanation )

1 Answers   Amazon, Peak6, Yahoo,


Categories