#include<iostream> using std::cout; int main () { int en_vektor[4]; en_vektor[0] = 1; en_vektor[1] = 2; en_vektor[2] = 3; en_vektor[3] = 4; cout << en_vektor[0] << en_vektor[1] << en_vektor[2] << en_vektor[3] << "\n"; return 0; }
#include<iostream> using std::cout; using std::cin; int main () { int array[10]; cout << "Mata in tio tal:\n"; for (int i=0; i < 10; i++) { cin >> array[i]; } for (int i=0; i < 10; i++) { cout << "Tal nummer " << i << " har värdet: " << array[i] << "\n"; } return 0; }
Källa: http://blinkenlights.se/