注册 登录
编程论坛 C++教室

请问下我这个程序要怎么修改才可以增加一个计算的过程.初学者。希望哪位好心人能帮忙修改详细点.别人说是赋值什么的。但是不了解什么意思啊

kofvi 发布于 2011-08-09 13:49, 603 次点击
using System;

namespace practicalTest2
{
    class Program
    {
        static void Main(string[] args)
        {
            // Declare and initialise constants
            const int MIN_YEAR = 1900;
            const int MAX_YEAR = 2011;
            
            // RATING constants
            const int MIN_RATING = 0;
            const int MAX_RATING = 5;

            const float ACTING_PERCENTAGE = 0.25F;
            const float MUSIC_PERCENTAGE = 0.15F;
            const float CINEMATOGRAPHY_PERCENTAGE = 0.20F;
            const float PLOT_PERCENTAGE = 0.30F;
            const float DURATION_PERCENTAGE = 0.10F;

            // Declare and initialise variables
            
            // Movie variables
            string movie_title = "";
            int year_released = MIN_YEAR;
            string publisher = "";
            float length = 0.0F;

            // Rating variables
            int acting_rating = MIN_RATING;
            int music_rating = MIN_RATING;
            int cinematography_rating = MIN_RATING;
            int plot_rating = MIN_RATING;
            int duration_rating = MIN_RATING;

            // Set test values to variables
            movie_title = "Singing Bone";
            year_released = 2010;
            publisher = "Timberlake Productions";
            length = 3.5F;

            // Rating variables
            acting_rating = 4;
            music_rating = 3;
            cinematography_rating = 4;
            plot_rating = 3;
            duration_rating = 2;

            // Output the movie data
            Console.WriteLine("Movie Information");
            Console.WriteLine("Movie Title : {0}", movie_title);
            Console.WriteLine("Year released : {0}", year_released);
            Console.WriteLine("Publisher  : {0}", publisher);
            Console.WriteLine("Length (hrs) : {0}", length.ToString("F1"));
            Console.WriteLine("Ratings");
            Console.WriteLine("Acting : {0}", acting_rating);
            Console.WriteLine("Music : {0}", music_rating);
            Console.WriteLine("Cinematography : {0}", cinematography_rating);
            Console.WriteLine("Plot : {0}", plot_rating);
            Console.WriteLine("Duration : {0}", duration_rating);
        }
    }
}


计算的公式是
Movie Title
Year released
Publisher
Length (hrs)
Rate the acting (out of 5)
Rate the music (out of 5)
Rate the cinematography (out of 5)
Rate the plot (out of 5)
Rate the duration (out of 5)
Calculate the movie rating using the following:

Rate the acting (out of 5) : 25% of overall rating
Rate the music (out of 5) : 15% of overall rating
Rate the cinematography (out of 5) : 20% of overall rating
Rate the plot (out of 5) : 30% of overall rating
Rate the duration (out of 5) : 10% of overall rating

最后还要体现出输出的结果
Movie Information
Movie Title : Singing Bone
Year released : 2010
Publisher : Timberlake Productions
Length (hrs) : 3.5
Ratings
Acting : 4
Music : 3
Cinematography : 4
Plot : 3
Duration : 2

Overall rating is  7/10 : *******

2 回复
#2
hahayezhe2011-08-09 13:52
C# 发错版块了
#3
kofvi2011-08-09 14:52
没找到c#的板块啊。。。在哪里啊
1