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

program to find magic aquare using array

4 Answers   HCL,


write a c-program to display the time using FOR loop

3 Answers   HCL,


Predict the Output: int main() { int *p=(int *)2000; scanf("%d",2000); printf("%d",*p); return 0; } if input is 20 ,what will be print

2 Answers  


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,


write a c program to Create a mail account by taking the username, password, confirm password, secret_question, secret_answer and phone number. Allow users to register, login and reset password(based on secret question). Display the user accounts and their details .

2 Answers  






main() { char *p="hai friends",*p1; p1=p; while(*p!='\0') ++*p++; printf("%s %s",p,p1); }

3 Answers  


main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }

9 Answers   CSC, GoDB Tech, IBM,


Program to Delete an element from a doubly linked list.

4 Answers   College School Exams Tests, Infosys,


main() { char a[4]="HELLO"; printf("%s",a); }

3 Answers   CSC,


What is "far" and "near" pointers in "c"...?

3 Answers  


print numbers till we want without using loops or condition statements like specifically(for,do while, while swiches, if etc)!

11 Answers   Wipro,


int aaa() {printf(“Hi”);} int bbb(){printf(“hello”);} iny ccc(){printf(“bye”);} main() { int ( * ptr[3]) (); ptr[0] = aaa; ptr[1] = bbb; ptr[2] =ccc; ptr[2](); }

1 Answers  


Categories