View Single Post
  #1 (permalink)  
Old 04-24-2008, 12:26 PM
ISmajor ISmajor is offline
Newbie
 
Join Date: Apr 2008
Posts: 1
Credits: 1
Rep Power: 0
ISmajor is on a distinguished road
Default help with arrays...

i am trying to write a program with two arrays...

my code::
Code:
// project5.cpp : main project file.

#include "stdafx.h"

using namespace System;

int main(array<System::String ^> ^args)
{
double hours __gc[] = new double __gc[10];
double charges __gc[] = new double __gc[10];
double total;

do
Console::WriteLine( L"Enter the number of hours parked:" );
hours[i] = Double::Parse( Console::ReadLine() );
if hours[i] > 24
Console::WriteLine( L"Maximum number of hours has been exceeded");
while hours[i] > 24

if hours[i] <= 2
charges[i] = 5
else
charges[i] = ((hours - 2) * .5) + 5;

if hours[i] > 10
charges[i] = 10;

Console::WriteLine( L"Car Number:\tHoursParked:\tAmount Charged:");

for (double i = 1, i <= 10, i++)
Console::WriteLine( L "{0}\t\t{1}\t\t{2}", i.ToString(), hours[i].ToString(), charges[i].ToString() );

for (int i = 0; i<charges-> Length; i++)
total += charges[i];

Console::WriteLine( L"Total Charges from Yesterday: {0}", total.ToString() );

return 0;
}

ERRORS:
.\project5.cpp(9) : error C4980: '__gc' : use of this keyword requires /clrldSyntax command line option
.\project5.cpp(9) : error C2440: 'initializing' : cannot convert from 'double *' to 'double []'
There are no conversions to array types, although there are conversions to references or pointers to arrays
.\project5.cpp(10) : error C2440: 'initializing' : cannot convert from 'double *' to 'double []'
There are no conversions to array types, although there are conversions to references or pointers to arrays
.\project5.cpp(15) : error C2061: syntax error : identifier 'hours'
.\project5.cpp(16) : error C2061: syntax error : identifier 'hours'
.\project5.cpp(18) : error C2061: syntax error : identifier 'hours'
.\project5.cpp(25) : error C2061: syntax error : identifier 'hours'
.\project5.cpp(30) : error C2143: syntax error : missing ',' before '<='
.\project5.cpp(30) : error C2086: 'double i' : redefinition
.\project5.cpp(30) : see declaration of 'i'
.\project5.cpp(33) : error C2227: left of '->Length' must point to cl***/struct/union/generic type
type is 'double []'
Edit/Delete Message

Last edited by WingedPanther; 05-04-2008 at 07:08 PM. Reason: add code tags
Reply With Quote

Sponsored Links