Skip to main content
gamedev.net
🔒 Locked

MC++.Net problem

Started by dk32321 0 replies 250+ views
Original Post
dk32321
dk32321
I am trying to make a program that reads in a number into an array and calls a function to display it but all i get is array is System.Int32[]. I know i am probably forgetting something really little. If anybody can help me i appreciate it here is the code: // This is the main project file for VC++ application project // generated using an Application Wizard. #include "stdafx.h" #using <mscorlib.dll> using namespace System; void arraywrite(int __gc[]) ;//write out the array int getnum(); const arraynum = 5; int _tmain() { // TODO: Please replace the sample code below with your own. int arrays __gc[] = new int __gc[arraynum]; for(int i = 0; i < arraynum;i++) { arrays = getnum(); arraywrite(arrays); } return 0; } int getnum() { int num; Console::WriteLine(S"Please enter a number "); return (num = Int32::Parse(Console::ReadLine())); } void arraywrite(int arrays __gc[]) { Console::WriteLine(S" array is {0}",arrays.ToString()); }
perfectly_dark
perfectly_dark
Console::WriteLine(S" array is {0}",arrays[0].ToString());

Or replace 0 with some index

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.