I have been asked this questions before but this time i want to know the difference between the compiler of C++ and C#.
C# coding of array
static void Main(string[] args)
{
int n;
int[] ar = new int[50];
Console.Write("Enter the size of array= ");
n = int.Parse(Console.ReadLine());
for (int i = 0; i < n; i++)
{
ar[i] = int.Parse(Console.ReadLine());
}
for (int i = 0; i < n; i++)
{
Console.WriteLine("AR[" + i + "]=" + ar[i]);
}
Console.Read();
}
Output

C++ coding of array
int main()
{
clrscr();
int x[10];
int n;
cout << "Enter the array size= ";
cin >> n;
cout << "Enter the elements for array= ";
for(int i = 0; i < n; i++)
{
cin >> x[i];
}
for(int i = 0; i < n; i++)
{
cout << "x[" << i << "]=" << x[i] << "\n";
}
getch();
return 0;
}
Output

Now here my question is this when m giving the same input for the C# then its asking for 4 elements to input and leave the 0 before any digit. But when m going with same input in C++ then its considering the 0 with any digit a separate input even m giving it with a digit and took less input then i entered.
Even both languages follow the OOP approach. So what are the difference between both compiler. Why these are taking a lots of different input and generating different output.
One more that bother me that why the C++ compiler not reading 0 for last element and print the 7 but my input is 07 so according to its above output it should be 0 not 7.