| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1127 人关注过本帖
标题:错误:非静态的字段、方法或属性Program.F(ref int, ref int, ref int, ref ...
只看楼主 加入收藏
ailiyaxman
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-5-17
收藏
 问题点数:0 回复次数:1 
错误:非静态的字段、方法或属性Program.F(ref int, ref int, ref int, ref int)”
using System;
using System.Collections.Generic;
using System.Text;

namespace 自学
{
    class Program
    {
        public void F(ref int x,ref int y,ref int z,ref int n)
    {
        
            for (int i = 0; i < n;i++ )
            z = x * (1 + y);
    }
        static void Main(string[] args)
        {
            Console.WriteLine("请输入本金:");
            int B = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("请输入利率:");
            int L = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("请输入时间:");
            int N = Convert.ToInt32(Console.ReadLine());
            int Z=0;
            F(ref B, ref L,ref Z,ref N);
            Console.WriteLine("本利和为{0}", Z);

        }
    }
}
搜索更多相关主题的帖子: int ref Program 字段 静态 
2008-05-26 23:59
ailiyaxman
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2008-5-17
收藏
得分:0 
using System;
using System.Collections.Generic;
using System.Text;

namespace 自学
{
    class Program
    {
        public void F(ref int x, ref int y, ref int z, ref int n)
        {

            for (int i = 0; i < n; i++)
            {
                z = (x * (1 + y))*i;
            }
        }
        static void Main(string[] args)
        {
            Console.WriteLine("请输入本金:");
            int B = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("请输入利率:");
            int L = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("请输入时间:");
            int N = Convert.ToInt32(Console.ReadLine());
            int Z=0;
            F(ref B, ref L,ref Z,ref N);
            Console.WriteLine("本利和为{0}", Z);

        }
    }
}
是在是找不到错啊 ,有没有人帮忙看一下 啊,哭了!!!
2008-05-27 00:14
快速回复:错误:非静态的字段、方法或属性Program.F(ref int, ref int, ref int ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027894 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved