日期:2014-05-18  浏览次数:20748 次

第三次问问题了,大家捧捧场好吗????如果要我加分,直接说,爽快一点,只想知道最终的解释是什么
已经第三次贴出来了,但是前两次,还是有几个问题,我感觉解释的还是很单薄

特别是关于Mandelbrot图像,的问题
摆脱了,大大们

http://topic.csdn.net/u/20080531/15/76ade66e-2cc0-4a62-9d10-0aa602f0b384.html




1.下面那些不是隐式转换?


  int转换为short
  short转换为int
  bool转换为string
  byte转换为float

  bool转换为sting 和 short转换为 int 不是隐式转换

2.short类型包含彩虹的颜色,再加上黑色和白色,据此编写color枚举的代码。这个枚举可以使用byte类型吗?


这个我暂时还无法给出答案,只是有一个思路

每个颜色都有相应的代号,如果加上黑色和白色的代号,然后加起来为一个数字,如果这个不超过byte可以支持的最大位数,就可以用byte,如果小于,就不能用了。


3.修改第四章的Mandelbrot图像生成实力,使用下面的结构表示复杂的数字:

struct imageNum
{
  public double real,imag;
}

  对于以前的那个Mandelbrot还是不甚理解,这道题的意思难道是用struct把后面的那些.o0@进行提前的结构化吗?



应该不是吧?
4.下面的代码可以成功编译吗?如果不能,为什么?

  string[] blab=new string[5]
  string[5]=5th string.

  谁有更好的解释呢?


5.编写一个控制台应用程序,它接受用户输入的一个字符串,将其中的字符与输入相反的顺序输出。

  static void Main(string[] args)
  {
  string a, b, c; 
  a = Console.ReadLine();
  b = Console.ReadLine();
  c = Console.ReadLine();
  string[] cost = { a, b, c };
  int i;
  for (i = 10; i < cost.Length; i--) ;
  {
  Console.WriteLine(cost[i]);
  }
  Console.ReadKey();
   
但是到最后无法达到我要的效果
我是按照书中的示例改变过来的,书中是从正数排列,所以,我把int定义为大的,然后来个i--,但是看来这个效果,没有用,而且在vs中还弹出一个 警告。

6.编写一个控制台应用程序,它接受一个字符串,用yes替换字符串中所有的no。


用于替换的命令是什么


7.编写一个控制台应用程序,给字符串中的每个单词加上双引号。


其他的东西我不写了,只写一些主要的

加上双引号,也就是在左边还有右边加上

myString=myString.PadLeft(");
myString=myString.PadRight(");
后面两个命令可以写到一行里面吗??






------解决方案--------------------
1,2
ok
3
no idea

string[5]=5th string. => blaa[4] = "5th street";
5
string input = Console.ReadLine();
char[] chars = input.ToCharArray();
Array.Reverse( chars );
Console.WriteLine( new string( chars ) );
6
string input = Console.ReadLine();
input.Replace( "yes", "no" );
7
string input = Console.ReadLine();
string[] words = input.Split( new char[]{' '} );
foreach( string word in words)
{
Console.Write( "\"{0}\" ", word );
}
  


------解决方案--------------------

string input = Console.ReadLine(); 
input = input.Replace( "yes", "no" );