cours:bat4:exemple_chaine_caracteres
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string input = "Hello World!";
for (int i=0; i<input.Length; i++)
{
// Get the integral value of the character.
Console.WriteLine("Letter is {0}", input[i]);
}
// to avoid automatic console close
Console.ReadLine();
}
}
}
on peut aussi
using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string input = "Hello World!";
foreach (char letter in input)
{
// Get the integral value of the character.
Console.WriteLine("Letter is {0}", letter);
}
// to avoid automatic console close
Console.ReadLine();
}
}
}
cours/bat4/exemple_chaine_caracteres.txt · Dernière modification : 2014/11/26 16:03 de tigli