using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MaxSum
{
class Program
{
static void Main(string[] args)
{
int i, j, n, t;
int[] a = new int[100];
Console.WriteLine("input number of data(<99):");
n = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("input",n"data"); //????
for(i-1;i<=n;i++)
{
a[i]=Convert.ToInt32(Console.ReadLine()); //input(a[i]); ???
i=j;
j=1;
t=max_sum(a,n,&i,&j);
Console.WriteLine("The most sum of section is");
Console.WriteLine(t);
Console.WriteLine("strarting point is");
Console.WriteLine(i);
Console.WriteLine("end point is");
Console.WriteLine(j);
}
}
int max_sum_a(int[] a, int n, int *best_i, int *best_j) //???
{
int i, j, this_sum, sum;
sum = 0;
*best_i = 0;
*best_j = 0;
for (i = 1; i <= n; i++)
{
this_sum = 0;
for (j = i; j <= n; j++)
{
this_sum = this_sum + a[k];
if (this_sum > sum)
{
sum = this_sum;
*best_i = i;
*best_j = j;
}
}
return (sum);
}
}
}
}
带问号的地是提示错误...应该怎么改啊?最好能实现....