Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Business.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Oef3p24
- {
- class Business
- {
- public int telWoorden(string zin)
- {
- int aantal = 1;
- for(int teller = 0; teller < zin.Length; teller++)
- {
- if(zin[teller]==' ')
- {
- aantal += 1;
- }
- }
- return aantal;
- }
- }
- }
- //Program.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Oef3p24
- {
- class Program
- {
- static void Main(string[] args)
- {
- Business rekenen = new Business();
- Console.WriteLine("Schrijf een zin.");
- rekenen.Zin = Console.ReadLine();
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Het aantal woorden in deze zin: " + rekenen.telWoorden(rekenen.Zin));
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment