T
TGuilliod
errors displayed when i tried o compile my program:.\project5.cpp(9) :
error C4980: '__gc' : use of this keyword requires /clrldSyntax
command line option
.\project5.cpp(15) : error C2061: syntax error : identifier 'hours'
.\project5.cpp(20) : error C2061: syntax error : identifier 'hours'
this is my program:
// project5.cpp : main project file.
#include "stdafx.h"
using namespace System;
int main(array<System::String ^> ^args)
{
int hours __gc[ 10 ];
int charges __gc[ 10 ];
Console::WriteLine( L"Enter the number of hours parked:" );
hours[10] = Int32:arse( Console::ReadLine() );
if hours <= 2
charges = 5
else
charges = (hours – 2) * .50 + 5.00;
if hours > 10
charges = 10;
Console::WriteLine (L"car number\thours parked\t\amount charge" );
//output values for each array
for (int i = 1; i <= 10; i++ )
Console::WriteLine( L"{0}\t\t{1}\t\t{2}", i. ToString(),
hours[ i ].ToString(), charges[ i ].ToString() );
return 0;
}
this is the question:
A Parking Garage charges a $5.00 minimum fee to park for up to two
hours or less. The Garage charges an additional $0.50 per hour for
each hour or part thereof in excess of two hours. The maximum charge
for any given 24-hour period is $10.00. Assume that no car will be
allowed to park for longer than 24 hours at a time.
Write a program that will compute and print the Parking Charges for
each of 10 Customers who parked their cars in this Garage yesterday.
You should enter at the Console the Hours Parked for each Customer
into an Array,
then calculate and store each customer’s charge in an Array as well.
(hint: Use two parallel arrays; hours and charges).
error C4980: '__gc' : use of this keyword requires /clrldSyntax
command line option
.\project5.cpp(15) : error C2061: syntax error : identifier 'hours'
.\project5.cpp(20) : error C2061: syntax error : identifier 'hours'
this is my program:
// project5.cpp : main project file.
#include "stdafx.h"
using namespace System;
int main(array<System::String ^> ^args)
{
int hours __gc[ 10 ];
int charges __gc[ 10 ];
Console::WriteLine( L"Enter the number of hours parked:" );
hours[10] = Int32:arse( Console::ReadLine() );
if hours <= 2
charges = 5
else
charges = (hours – 2) * .50 + 5.00;
if hours > 10
charges = 10;
Console::WriteLine (L"car number\thours parked\t\amount charge" );
//output values for each array
for (int i = 1; i <= 10; i++ )
Console::WriteLine( L"{0}\t\t{1}\t\t{2}", i. ToString(),
hours[ i ].ToString(), charges[ i ].ToString() );
return 0;
}
this is the question:
A Parking Garage charges a $5.00 minimum fee to park for up to two
hours or less. The Garage charges an additional $0.50 per hour for
each hour or part thereof in excess of two hours. The maximum charge
for any given 24-hour period is $10.00. Assume that no car will be
allowed to park for longer than 24 hours at a time.
Write a program that will compute and print the Parking Charges for
each of 10 Customers who parked their cars in this Garage yesterday.
You should enter at the Console the Hours Parked for each Customer
into an Array,
then calculate and store each customer’s charge in an Array as well.
(hint: Use two parallel arrays; hours and charges).