Kapa._
Kapa._
CC#
Created by Kapa._ on 4/22/2024 in #help
Press enter only
I want to code a loop which only takes spacebar for the code to loop. E.g. While (true) { Console.ReadKey(" ") loop... } However, this isint working.
19 replies
CC#
Created by Kapa._ on 4/21/2024 in #help
What could I do to make this neater?
No description
4 replies
CC#
Created by Kapa._ on 3/20/2024 in #help
✅ Implementing a step counter
No description
5 replies
CC#
Created by Kapa._ on 3/20/2024 in #help
✅ Binary Search
No description
5 replies
CC#
Created by Kapa._ on 3/19/2024 in #help
✅ Sorted Array not Printing
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A_C_Assignment
{
internal class BubbleSort
{
public static void BubbleAscend(int[] arr)
{
int n = arr.Length;
for (int i = 0; i < n - 1; i++)
{
for (int j = 0; j < n - 1; j++)
{
if (arr[j] > arr[j+1])
{
int temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}

Console.ReadKey();
}

public static void BubbleDescend(int[] arr)
{
int n = arr.Length;
for (int i = 0; i < n - 1; i++)
{
for (int j = 0; j < n - 1; j++)
{
if (arr[j] < arr[j + 1])
{
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}

Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A_C_Assignment
{
internal class BubbleSort
{
public static void BubbleAscend(int[] arr)
{
int n = arr.Length;
for (int i = 0; i < n - 1; i++)
{
for (int j = 0; j < n - 1; j++)
{
if (arr[j] > arr[j+1])
{
int temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}

Console.ReadKey();
}

public static void BubbleDescend(int[] arr)
{
int n = arr.Length;
for (int i = 0; i < n - 1; i++)
{
for (int j = 0; j < n - 1; j++)
{
if (arr[j] < arr[j + 1])
{
int temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}

Console.ReadKey();
}
}
}
31 replies
CC#
Created by Kapa._ on 3/18/2024 in #help
Assignment
No description
83 replies