cout<<char(100)<<" "<< int (`C')<< " "
<<(int(`1')+3) << endl;
struct DataRec
{
int one;
long two;
double three;
char four[30];
};
DataRec arr[]={{1, 3, 5.6, "ABC"}, {6, 8, 34.5, "def"}, {5, 7, -106.56, "ghijk"}}, *p=arr;
char str1[32]="string one", str2[32], str3[33]; char c;
cin >> str2; cin.get(c); cin.getline(str3, 33, `\n');
#include <iostream.h>
#include < string.h>
void main(void)
{
char line[32], *chptr, *fnptr;
char delimiter;
int i=0;
cin.getline(line, 32, '\n');
cout << "Delimiter character";
cin >> delimiter;
chptr=strchr(line, delimiter);
*chptr='\0';
fnptr=chptr+1;
chptr=strchr(fnptr, delimiter);
*chptr++ = '.';
strcat(chptr, "xxx");
cout << line; //output #1
cout << fnptr; // output #2
}
Assume the input is "Jones:465-29-8153:home" and the delimiter character is
':'
| 7 | 65 | 66 | 67 | 68 | 0 | 50 | 51 | 97 | 98 | 99 | 0 |
|---|
#include <iostream.h>
#include <strstream.h>
void main(void)
{
char streamchar[32]="40TNT 5.50 12.25";
istrstream istr(streamchar, sizeof(streamchar));
int i, j, k;
float a, b, c;
char ch1, ch2, ch3;
char str[8];
istr >> i; cout << i << endl; //output 1=____
istr >> str; cout << str << endl; //output 2=___
istr >> ch1; cout << ch1 << endl; // output3=___
istr>> a; cout << a << endl; // output 4=___
istr>> ch2; cout << ch2 << endl; //output 5=___
istr>> j; cout << j << endl; //output 6=____
istr>> b; cout << b << endl; //output 7=___
}
#include <iostream.h>
#include <string.h>
char *Retr(char *list, int n, char k)
{
int i;
char *p;
for (i=0 p=list; i<n;i++,p++)
if(*p==k)
return p; //return pointer
return NULL;
}
void main(void)
{
char *str="c:/cplus/include", *p=str, *q;
while ((q=Retr(p, strlen(p),'/'))!=NULL)
{
*q='\0';
cout << p << " ";
p=q+1;
}
cout << p << endl // Output Statement
}
Give the output from the cout statement. ____
#include <iostream.h>
void main(void)
{
char str[]="pacific";
int i= 0;
while (str[i]!=0)
{
if (str[i]<'f')
str[i++]+=1;
else
str[i++]-=1;
}
cout << "Resulting string is "<< str << endl;
//Output statement.
}
Output is ____
#include<iostream.h>
#define NULL 0
char *ri(char *sp, char c)
{
char *r=NULL;
do
if(*sp==c)
r=sp;
while(*sp++);
return(r);
}
void main(void)
{
char ch='s';
char line[80], *l;
cin.getline(line, 80, '\n'); //Reads a null terminated string
l=ri(line, ch);
cout << *l << *(l+1) << endl;
}
N=± 1.d1d2.....dn-1x 2e
Sign The leftmost bit is used for the sign. A "+" has 0 sign bit, and a "-"
has a 1 sign bit.
Exponent The exponent is stored in 8 bits in "excess-127" notation.
Mantissa The mantissa takes the normalized form and stores the binary digits.
The leading 1 digit is hidden.