C#:Réponses aux exercices apcpedagogie chaîne 001
C#:Réponses aux exercices apcpedagogie c# chaîne 001Solutions Exercice apcpedagogie chaîne 001Enoncé
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Exercice_apcpedagogie_c_chaîne_001
{
class Program
{
static void Main(string[] args)
{
//testerunechaine();
//testerunecaractere();
//dernierCaractere();
compterEspace();
}
static void testerunechaine()
{
String chaineATester = "MOHAMED";
string c1 = chaineATester[0].ToString();
if (chaineATester.Equals(chaineATester.ToUpper()))
{
System.Console.WriteLine("La chaîne est en majuscules");
}
else
{
System.Console.WriteLine("La chaîne est en minuscules");
}
}
static void testerunecaractere()
{
String chaineATester = "MOHAMED";
string c1 = chaineATester[0].ToString();
if (c1.Equals(chaineATester.ToUpper()))
{
System.Console.WriteLine("Le caractère est en majuscules");
}
else
{
System.Console.WriteLine("Le caractère est en minuscules");
}
}
static void dernierCaractere()
{
String chaineATester = "MOHAMED";
String c1=chaineATester.Substring((chaineATester.Length-1));
if (c1.Equals(chaineATester.ToUpper()))
{
System.Console.WriteLine("Le caractère est en majuscules");
}
else
{
System.Console.WriteLine("Le caractère est en minuscules");
}
}
static void compterEspace()
{
String chaineATester = "apcpedagogie.com est notre site de travail depuis lengtemps";
int nbrmots = 0;
for (int i=0;i
|
