Hydrological Analysis and computing-average annual traffic and Annual Extreme flood volume

Source: Internet
Author: User

[Cpp]
// Average annual traffic and Annual Extreme flood. h
Void NianJunZhi ()
{
Using namespace std;
Ofstream outfile;
Outfile. open ("outfile_yearq_cmdtxt ");
Outfile <setw (10) <"year" <setw (10) <"days" <setw (10) <"average annual traffic ";
For (int k = 0; k <J; k ++)
Outfile <setw (7) <"maximum" <NumJ [k] <"day ";
Outfile <endl;
Ifstream infile;
Infile. open ("infile_DayQ.txt ");
For (int I = 0; I <Y; I ++)
{
Year = StartYear + I;
SumDay [I] = Sum [12]; // Initialization
If (Year = StartYear)
SumDay [I]-= (Sum [StartMonth-1] + StartDate-1 );
If (Year = EndYear)
SumDay [I] = Sum [EndMonth-1] + EndDate;
If (Year % 400 = 0 | (Year % 4 = 0 & Year % 100! = 0 ))
{
If (Year = StartYear & StartMonth <2) SumDay [I] ++;
If (Year = EndYear & EndMonth> 2) SumDay [I] ++;
If (Year! = StartYear & Year! = EndYear) // & amp; SumDay [I] = Sum [12]
SumDay [I] ++; // a leap year with a day added in February
}
YearQ [I] = 0; // Initialization
For (int j = 0; j <SumDay [I]; j ++)
{
Infile> Q [j];
YearQ [I] + = Q [j];
}
YearQ [I]/= SumDay [I];
Outfile <setw (10) <Year <setw (10) <SumDay [I] <setw (10) <YearQ [I];
For (int k = 0; k <J; k ++)
{// Calculate the Annual Extreme flood
MaxYearW [I] [k] = 0; // Initialization
For (int j = 0; j <SumDay [I]-NumJ [k] + 1; j ++)
{
Temp_W = 0; // Initialization
For (int n = 0; n <NumJ [k]; n ++)
Temp_W + = Q [j + n];
If (temp_W> MaxYearW [I] [k])
MaxYearW [I] [k] = temp_W; // (m3/s * month)
}
Outfile <setw (10) <MaxYearW [I] [k];
} Www.2cto.com
Outfile <endl;
}
Infile. close ();
Outfile. close ();
}
By: Superwen_go

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.