Computer Science, asked by low35, 1 year ago

write c++ statement for declare a variable 'mail' to store @

Answers

Answered by omegads03
8

#include<iostream.h>

#include<conio.h>

void main()

{

clrscr();

char mail = ‘@’;

cout<<”The character” <<mail<< “is  stored in the variable mail”<<int(mail);

getch();

}

The above code will store the character @ in the variable mail. Here in this program, int() function is used to convert the character to its ASCII value. We cannot store ‘@’ directly into a ‘char’ variable. Hence it should be converted into the ASCII value.  

ASCII stands for American Standard Code for Information Interchange. ASCII value is the number that represents the 128 English characters as numbers. Each 128 characters are assigned a number starting from 0 and ending in 127.

Similar questions