Search
 
SCRIPT & CODE EXAMPLE
 

CPP

C++ How to insert and print array elements?

int mark[5] = {19, 10, 8, 17, 9}

// change 4th element to 9
mark[3] = 9;

// take input from the user
// store the value at third position
cin >> mark[2];


// take input from the user
// insert at ith position
cin >> mark[i-1];

// print first element of the array
cout << mark[0];

// print ith element of the array
cout >> mark[i-1];
Comment

PREVIOUS NEXT
Code Example
Cpp :: C++ if...else Statement 
Cpp :: C++ Features 
Cpp :: c++ static array in Klasse 
Cpp :: how to find total numbe of distinct characters in a string in c 
Cpp :: time out search element in linked list c++ 
Cpp :: def minimulHeaviestSetA(arr,n) 
Cpp :: subsets of a given array 
Cpp :: c++ switch integer 
Cpp :: show mouse c++ 
Cpp :: how to display score using SDL in c++ 
Cpp :: attack on titan junior high list of episodes 
Cpp :: how to use comparitor in priority queu in c++ 
Cpp :: c++ power operator 
Cpp :: typeid to string c++ 
Cpp :: dualSort 
Cpp :: Chef and Feedback codechef solution in cpp 
Cpp :: online compiler cpp 
Cpp :: assignment operator 
Cpp :: middle node of linked list 
Cpp :: c++ permutation 
Cpp :: c++ copy string 
Cpp :: how to define range of numbers inside a if condition in c++ 
Cpp :: how to make a c++ iostream program restart when finished 
C :: swapping of two numbers in c without temporary variable 
C :: write in file in c 
C :: scanf ignore new line 
C :: type change in c 
C :: printf c float 
C :: how to ban websites on mac 
C :: matplotlib plot circle marker 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =