Computer Science Class-Xii (Pointers Assignment) : Cout A++ ++B ++C Endl
Computer Science Class-Xii (Pointers Assignment) : Cout A++ ++B ++C Endl
Computer Science Class-Xii (Pointers Assignment) : Cout A++ ++B ++C Endl
void main()
{ char s[ ]="CoMPuTEr FUN";
int len=strlen(s);
cout<<"\n Before change the string is…."<<endl;
cout<<s<<'\t'<<len;
change(s,len);
cout<<"\n After change the string is…"<<endl;
cout<<s<<'\t'<<len;
}
5) Write the output of the following programming code:
char *str="HeLLoWOrLd";
int len=strlen(str)-1;
for(int i=0;i<len-i;i++)
{ str[len]=(isupper(str[len])?tolower(str[len]):toupper(str[len]));
cout<<str<<endl;
str++;
len--;
}
6) Write the output of the following program code:
void getstr(char str[])
{ for (int i = 1; i < strlen (str); i++)
if (isupper (str[i-1]))
str[i-1] = tolower (str[i]);
else
str[i] = toupper (str[i-1]);
}
void main()
{ char s[] = "aNDarIeL";
getstr(s);
cout <<s;
}
7) Write the output of the following program code:
int x = 10;
void pass(int &a, int b, int &c)
{ int x = 4;
c += x;
a *= ::x;
b += c; }
void main()
{ int y = 1, x = 2;
pass(y, ::x, x);
cout << x << ':' << y << ':' << ::x<<endl;
pass(::x, x, y);
cout << x << ':' << y << ':' << ::x;
}