0% found this document useful (0 votes)
9 views12 pages

Visual Programming Projects in C#

Uploaded by

saadalimubarack
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views12 pages

Visual Programming Projects in C#

Uploaded by

saadalimubarack
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ASSIGNMENT

Visual Programming

Submitted to:

Rida Bajwa

Submitted by

Saad Ali Mubarak


222201017
Department of Computer Science,
Word Scramble Game:

using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];

namespace wordScrable
{
internal class Program
{

public static int a = 0;

public static async Task ges()


{

[Link](() =>
{
[Link](5000).Wait();

a = 1;

});

}
public static async Task word()
{
int test = 0;
st:
string[] arr = { "apple", "banana", "cherry", "date", "elderberry",
"fig", "grape", "honeydew", "kiwi", "lemon" };
Random ra = new Random();

int n = [Link](0, [Link]);


[Link](RandomizeString(arr[n]));
[Link]("Enter correct string in 5 sec:");
string check = [Link];
await ges();
check = [Link]();

if (check == arr[n])
{
[Link]("Correct");
test += 10;

if (a == 1)
{
[Link]("You Enter late -5");
test -= 5;

}
else
{
[Link]("Wrong");
if (a == 1)
{
[Link]("You Enter late -5");
test -= 5;

[Link]("Do you want do it again enter y");


string ch = [Link]();
if (ch == "y")
{
[Link](5000).Wait();
a = 0;
goto st;
}
[Link]($"Total points={test}");

public static string RandomizeString(string input)


{
Random rng = new Random();
return new string([Link](c => [Link]()).ToArray());
}
static void Main(string[] args)
{

word();

[Link]();
}

}
}

Prime Number Finder:

using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];

namespace primeNumber
{
internal class Program
{

static bool IsPrime(int number)


{
if (number <= 1)
return false;
if (number == 2 || number == 3)
return true;
if (number % 2 == 0 || number % 3 == 0)
return false;

for (int i = 5; i * i <= number; i += 6)


{
if (number % i == 0 || number % (i + 2) == 0)
return false;
}

return true;
}
static void Main(string[] args)
{
[Link]("Enter Starting :");
int a = Convert.ToInt32([Link]());
[Link]("Enter Ending :");
int b = Convert.ToInt32([Link]());
ArrayList arr = new ArrayList();
[Link]($"Prime numbers from {a} to {b}:");
for (int i = a; i <= b; i++)
{
if (IsPrime(i))
{
[Link](i);
[Link](i + " ");
}
}

[Link]("\nif you want to filter even prime or odd prime Enter y");
string ch = [Link]();
if (ch == "y")
{
[Link]("Even or odd(e or o)");
string c = [Link]();
if (c == "e")
{
foreach(int i in arr)
{
if (i % 2 != 0)
{

[Link](i + " ");


}
else
{
[Link](i);
}
}
}
else if (c == "o")
{
foreach (int i in arr)
{
if (i % 2 == 0)
{

[Link](i + " ");


}
else
{
[Link](i);
}
}
}

}
[Link]("Do you want save in file(Enter y)");
string fi = [Link]();
if (fi == "y")
{
string filePath = "[Link]";
using (StreamWriter writer = new StreamWriter(filePath))
{
[Link]("Prime numbers :");
foreach (int i in arr)
{
[Link](i + " ");
}
}
}
}
}
}

Password Strength Checker:

using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];

namespace password
{
internal class Program
{
static void Main(string[] args)
{
At:
[Link]("Enter Password:");
string pass = [Link]();
char[] str = [Link]();
bool alp = false;
bool sp = false;
bool num = false;
if ([Link] > 15)
{
[Link]("Password is too long");
}
else
{
if ([Link] >= 8)
{
foreach (var item in str)
{
if ((int)item >= 65)
{
alp = true;
break;
}
else
{
alp = false;
}
}
foreach (var item in str)
{
if ((int)item <= 64 && ((int)item < 48 || (int)item > 57))
{
sp = true;
break;
}
else
{
sp = false;
}
}
foreach (var item in str)
{
if ((int)item >= 48 && (int)item <= 57)
{
num = true;
break;
}
else
{
num = false;
}

}
}
else
{
[Link]("Password too short try again");
goto At;
}

if (sp == true && num == true && alp == true)


{
[Link]("Your password is strong");
}
else if (sp == true || num == true && alp == true)
{
[Link]("Your password is moderate");
if (sp == false)
{
[Link]("Try Adding Special Character");
}
if (num == false)
{
[Link]("Try Adding Number");
}
if (alp == false)
{
[Link]("Try Adding Alphabets");
}
}
else if (sp == false && num == false || alp == false)
{
[Link]("Your password is weak");
if (num == true)
{
[Link]("Try adding Special character and alphabets");
}
if (sp == true)
{
[Link]("Try adding alphabets and number");
}
if (alp == true)
{
[Link]("Try adding Special character and number");
}
}
}
}
}
}

Number Guessing Game:

using System;
using [Link];
using [Link];
using [Link];
using [Link];

namespace randomGuess
{
internal class Program
{
static void Main(string[] args)
{

[Link]("Enter Difficulty:");

string d = [Link]();
Random random = new Random();
int guess=0;
int num = [Link](1, 101);
if (d == "hard")
{
guess = 5;
}
else if (d == "easy")
{
guess = 15;
}
else if (d == "medium")
{
guess = 10;
}
[Link]($"Your total guess are {guess}");
while(guess > 0)
{
[Link]($"Total guess remaining = {guess}");
[Link]("Enter Your Guess :");
int g = Convert.ToInt32([Link]());
if (g == num)
{
[Link]("Correct");
[Link]($"Your Score = {guess}");
break;
}
else if(g>num)
{
[Link]("Think lower");
}
else if(g<num)
{
[Link]("Think Higher");
}
guess--;

}
if (guess == 0)
{
[Link]("GameOver!");
}

}
}
}

You might also like