using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace ConsoleApplication12
{
class Program
{
static void Main(string[] args)
{
Authenic simon = new Authenic();
bool Done = simon.changePassword("wuengfei","MyNewPassWord");
if (Done == true)
Console.WriteLine("密码修改失败");
else
Console.WriteLine("密码修改成功");
Console.WriteLine();
}
}
class Authenic
{
private string Password = "wupengfei";
public bool IsPassWordCorrect(string userPassWord)
{
return (Password == userPassWord) ? true : false;
}
public bool changePassword(string oldPassword, string newPassWord)
{
if (oldPassword == Password)
{
Password = newPassWord;
return true;
}
else
return false;
}
}
}
程序运行后要输出改了之后的密码是什么,应该在红色部分怎么改?
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace ConsoleApplication12
{
class Program
{
static void Main(string[] args)
{
Authenic simon = new Authenic();
bool Done = simon.changePassword("wuengfei","MyNewPassWord");
if (Done == true)
Console.WriteLine("密码修改失败");
else
Console.WriteLine("密码修改成功");
Console.WriteLine();
}
}
class Authenic
{
private string Password = "wupengfei";
public bool IsPassWordCorrect(string userPassWord)
{
return (Password == userPassWord) ? true : false;
}
public bool changePassword(string oldPassword, string newPassWord)
{
if (oldPassword == Password)
{
Password = newPassWord;
return true;
}
else
return false;
}
}
}
程序运行后要输出改了之后的密码是什么,应该在红色部分怎么改?
解决方案 »
- 手机用USB连接电脑选择系列端口怎么没反应?
- 为什么这样判断 目录
- 问一个问题,C#如何生成一个与当前程序集无任何关系的dll文件呢?
- 求助dataGridView 中使用ComboBox 并且绑定到数据库的每一个字段 在同一个表 源码~~~~~~~~~~~~~~~~~~急!
- Windows下的DataGrid中,當某列的連續行值相同時,只顯示最上面那一行
- Activex控件AxMSFlexGrid响应鼠标滚动事件
- 请各位大哥帮帮忙,关于DataSet的行问题
- MFC如何调用C#编译的dll
- .NET中ExecuteScalar()方法执行数据库查询后,返回的三种空结果的区别
- 我通过HTTP获取到了网站里面的标题
- C#连接数据库的问题
- C# 多线程 窗口
String NewsPassword="XXXXXXXXXXXX";
Authenic simon = new Authenic();
bool Done = simon.changePassword("wuengfei",NewsPassword);
if (Done == true)
Console.WriteLine("密码修改失败");
else
Console.WriteLine("密码修改成功");
Console.WriteLine(NewsPassword);
{
Authenic simon = new Authenic();
string oldPassWord = "wuengfei";
string newPassWord = "MyNewPassWord"; bool Done = simon.changePassword(oldPassWord, newPassWord);
if (Done == true)
{
Console.WriteLine("密码修改失败");
Console.ReadKey();
}
else
{
Console.WriteLine("密码修改成功");
Console.WriteLine("新密码是:" + newPassWord);
Console.ReadKey();
} }
class Authenic
{
private string Password = "wupengfei";
public bool IsPassWordCorrect(string userPassWord)
{
return (Password == userPassWord) ? true : false;
}
public bool changePassword(string oldPassword, string newPassWord)
{
if (oldPassword == Password)
{
Password = newPassWord;
return true;
}
else
return false;
}
}
bool Done = simon.changePassword("wuengfei",newPassWord);
if (Done == true)
Console.WriteLine("密码修改成功"+newPassWord);
else
Console.WriteLine("密码修改失败");
Console.WriteLine();
string newPassWord="";
bool Done = simon.changePassword("wuengfei",newPassWord);
把后面的"MyNewPassWord" 以字符串形式传入,
bool Done = simon.changePassword("wuengfei",newPassWord);
这样输出newPassWord就可以了
// 改成这样就行
class Program
{
class Authenic
{
private string Password = "123";
public bool IsPassWordCorrect(string userPassWord)
{
return (Password == userPassWord) ? true : false;
}
public bool changePassword(string oldPassword,ref string newPassWord)
{
if (oldPassword == Password)
{
Password = newPassWord;
return true;
}
else
{
return false;
}
}
}
static void Main(string[] args)
{
Program.Authenic simon = new Authenic(); // Authenic simon = new Authenic();
string old_Password = Console.ReadLine();
string new_Password = Console.ReadLine();
bool Done = simon.changePassword(old_Password,ref new_Password);
if (Done == true)
{
Console.WriteLine("密码修改成功");
Console.WriteLine("The New PassWord is " + new_Password.ToString());
}
else
{
Console.WriteLine("密码修改失败");
}
}
}