C++ PROGRAM-GIVE COMMENTS (HOW THE CODE SOLVED i.e logics) ON EACH LINE OF THE CODE BELOW.
ACTUAL QUESTION: Write a program to insert an element at 17th index in an array of 20elements. Take all elements from user and display the output.
NOTE: IF YOU CAN'T ADD COMMENTS ON THIS CODE THEN DO ANOTHER CODE AND ADD COMMENTS ON THAT PLEASE. THANKS
CODE:
#include using namespace std;int main(){cout<>int arr[20],num;cout<"enter 20="" numbers:="">"enter>for (int i = 0; i < 20;="">{cin>>arr[i];}cout<"enter 17th="" element:="">"enter>cin >> num;cout<"\narray before="" changing="" 17th="" element:="">"\narray>for (int i = 0; i < 20;="">{cout < arr[i]="">< "="">}arr[16] = num;cout < "\narray="" after="" changing="" 17th="" element:="">for(int i=0;i<>{cout<><">">}cout <>return 0;}
int main(){cout<>int arr[20],num;cout<"enter 20="" numbers:="">"enter>for (int i = 0; i < 20;="">{cin>>arr[i];}
cout<"enter 17th="" element:="">"enter>cin >> num;cout<"\narray before="" changing="" 17th="" element:="">"\narray>for (int i = 0; i < 20;="">{cout < arr[i]="">< "="">}
arr[16] = num;cout < "\narray="" after="" changing="" 17th="" element:="">for(int i=0;i<>{cout<><">">}cout <>
return 0;}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here