| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 735 人关注过本帖
标题:[求助]怎样完成这个打印正方形的程序
只看楼主 加入收藏
热学男儿
Rank: 1
等 级:新手上路
帖 子:109
专家分:0
注 册:2007-4-28
收藏
 问题点数:0 回复次数:1 
[求助]怎样完成这个打印正方形的程序

小弟是刚刚开始学c#的,有一个程序题目,题中给出了程序的框架结构和运行结果,小弟实在是想不出,请大家帮忙完成,提前感谢。
题目给出的程序框架是:
using System;
using System.Collections.Generic;
using System.Text;

namespace c
{
class Point
{
public int x;
public int y;
public Point(int nx, int ny)
{ }
public Point(Point n)
{ }
public void Set(int nx, int ny)
{ }
public void Set(Point n)
{ }
public int getx()
{ }
public int gety()
{ }
}
class Class1
{
private int side;
private Point location;
public Class1(Point location,int length)
{ }
public void Class(Point center,int length)
{ }
public void graph(Point center,int length)
{ }
public int getarea()
{ }
public int getperimeter()
{ }
public int getlength()
{ }
public Point getlocation()
{ }
}
class program
{
static void Main(string[] args)
{
int x, y, a;
Console.WriteLine("请输入正方形的边长及位置:");
Console.WriteLine("边长:");
a = int.Parse(Console.ReadLine());
Console.WriteLine("位置:");
x = int.Parse(Console.ReadLine());
y = int.Parse(Console.ReadLine());
Class1 sd = new Class1(new Point(x, y), a);
Console.WriteLine("Square:");
Console.WriteLine("Length=" + sd.getlength());
Console.WriteLine("Location=" + sd.getlocation().getx() + sd.getlocation().gety());
Console.WriteLine("Perimeter=" + sd.getperimeter());
Console.WriteLine("Area=" + sd.getarea());
}
}
}

要求的运行结果是:
请输入正方形的边长及位置:
边长:6
位置:5
0
* * * * * *
* *
* *
* *
* *
* * * * * *
Square:
Length=6
Location=5,0
Perimeter=24
Area=36
Press any key to continue

[此贴子已经被作者于2007-9-14 21:47:05编辑过]

搜索更多相关主题的帖子: 正方形 int public using 
2007-09-14 21:45
热学男儿
Rank: 1
等 级:新手上路
帖 子:109
专家分:0
注 册:2007-4-28
收藏
得分:0 
有哪位朋友能帮帮我啊
2007-09-15 19:43
快速回复:[求助]怎样完成这个打印正方形的程序
数据加载中...
 
   



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

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