#include <iostream>
#include <vector>
std::vector<int> v;
int main(int argc, char* argv[]) {
while(1) {
int temp;
std::cout << "\nEnter a number: ";std::cin>>temp;
if(temp<0) {
std::cout << "\nEven number(s) is/are:\n---------------------\n";
for(int i=0;i<v.size();i++) {
if(v.at(i)%2==0) std::cout << v[i] << " ";
else continue;
}
std::cout << std::endl;
break;
}else {
v.push_back(temp);
}
}
return 0;
}
In the C programming language, you can't determine the array size from the parameter, so you have to pass it in as an extra parameter. The solution could be:
#include <stdio.h>
void swaparrayends(int arr[], int nrElements)
{
int temp = arr[0];
arr[0] = arr[nrElements - 1];
arr[nrElements - 1] = temp;
}
void main()
{
int i;
int myArray[] = { 1,2,3,4,5 };
int nrElements = sizeof(myArray) / sizeof(myArray[0]);
swaparrayends(myArray, nrElements);
for (i = 0; i < nrElements; i++)
{
printf("%d ", myArray[i]);
}
getchar();
}
In higher languages like C# it becomes much simpler:
static void Main(string[] args)
{
int[] myArray = {1, 2, 3, 4, 5};
swaparrayends(myArray);
foreach (var el in myArray)
{
Console.Write(el + " ");
}
Console.ReadLine();
}
static void swaparrayends(int[] arr)
{
int temp = arr[0];
arr[0] = arr.Last();
arr[arr.Length - 1] = temp;
}
Well we have SRAM(Static Random Access Memory) is faster, have a lower density but it is more expensive.
While DRAM(Dynamic Random access memory) is just the opposite.
Those are the only two, I know exist.
<h2>Answer and Explanation:</h2>
The picture shows the right careers with their respective career clusters.