0

Find the output asap.. And explain the program's working...

void main() { int a=0; char *n; char name[]="Internet Browsing"; for(a=0, n n=name;a<=4;a++,n++) { if( islower(name[a])) name[a]-=32; cout<<n<<"\n"; } }

13th Sep 2017, 4:24 PM
Utsuk Smile
Utsuk Smile - avatar
3 Antworten
0
is anyone there who can help me figure this out.. .. please.. I need help.. asap.
13th Sep 2017, 4:42 PM
Utsuk Smile
Utsuk Smile - avatar
0
Internet Browsing Nternet Browsing Ternet Browsing Ernet Browsing Rnet Browsing this is the output of this code /***************************************************/ #include <iostream> #include <string> using namespace std; void main() { int a=0; char *n; char name[]="Internet Browsing"; for(a=0, n=name;a<=4;a++,n++) { if( islower(name[a])) name[a]-=32; cout<<n<<"\n"; } int _; cin >> _; } /******************************************************/ int a=0; char *n; //you know what this means, initialising int a, and declaring character pointer n; char name[]="Internet Browsing"; //initialising a character array called name for ( a=0, n=name; //char pointer n will point to the first element of the char array //array names are pointers to the first element of the array a<=4; a++, //incrementing a by 1 n++ //incrementing character pointer to point to the next element in the array //remember pointer arithmatic ) { if( islower(name[a]) ) name [a] -= 32; //now this is interesting //if the element at position "a" (which is the int we are incrementing) //if that element is lowercase, decrease it's charCode by 32 //decreasing the charCode by 32 will make it uppercase //for example, the english letter lowecase "i" has a charCode of 105 //And the charCode of uppercase "I" is 73, which is 105 - 32 //All english lowercase and uppercase alphabets follow this pattern cout<<n<<"\n"; //this is very simple //it will print the char array FROM THE ELEMENT n IS POINTING TO, TILL THE END of the char array } I know it is clear to you ;) You know I started liking C++ but still I don't like the way programming is taught in these schools, the right way is starting with the simplest language and then going to the more detailed ones, here they are teaching you guys in the wrong way, that's why you guys don't like programming that much...
30th Sep 2017, 10:07 AM
Love Kenly
Love Kenly - avatar
0
........... Belive me Programming is a lot of fun, it's beautiful. You will get to know how crazy and awesome it can be once you play with JavaScript NOT Java! It's JavaScript! Thanks! :) :) :) :* :* :*
30th Sep 2017, 10:10 AM
Love Kenly
Love Kenly - avatar