Answer to Question #23916 in C++ for Tom Jose

Question #23916
what will be the output of the following program:
#include<iostream.h>
#include<ctype.h>
typedef char str[80];
void main()
{
char *notes;
str[80]="vR.2GooD";
int l=6;
notes=str;
while(l>3)
{str[l]=(isupper(str[l])?tolower(str[l]):toupper(str[l]));toupper(str[l]);
cout<<notes<<endl;
l--;
notes++;
}
}
The text says that the output is
VR2Good
R2Good
good how will i get that output?

thanks in advance........................
1
Expert's answer
2013-02-08T03:19:41-0500
#include <iostream>
#include <conio.h>
#include <ctype.h>

using namespace std;

char str[80] = "vR2GooD";

void main()
{
char* notes = str;
int l = 6;

while (l > 3)
{
str[l] = tolower(str[l]);
cout << notes << endl;
l--;
notes++;
}
_getch();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS