using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace Exercise_1
{
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
string name = "Quentin";
int x = 3;
x *= 17;
double d = Math.PI / 2;
myLable.Text = "name is " + name + "\nx is " + x + "\nd is " + d;
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
int x = 5;
if (x == 10)
{
myLable.Text = "x must be 10";
}
else
{
myLable.Text = "x isn't 10";
}
}
private void Button_Click_3(object sender, RoutedEventArgs e)
{
int someValue = 3;
string name = "Bobbo Jr.";
if ((someValue == 3) && (name == "Joe"))
{
myLable.Text = "x is 3 and name is Joe";
}
myLable.Text = "this line runs no matter what";
}
private void Button_Click_4(object sender, RoutedEventArgs e)
{
int count = 0;
while (count < 10)
{
count = count + 1;
}
for (int i = 1; i < 5; i++)
{
count = count - 1;
}
myLable.Text = "The answer is " + count;
}
}
}
效果图
主要是一些简单的语句和逻辑操作符的运用及赋值、初始化。
操作符:> (大于), < (小于), ==(等于) , != (不等于), && (相当于 and,必须满足全部条件), ||(满足其中一个条件)
循环语句(for,while)、判断语句(if/else)
初学者,如有不对请多多指教~~~
以上!!!