shawski.
shawski.
CC#
Created by shawski. on 7/14/2023 in #help
❔ VB in college
I am taking an intro to computer science as required to fulfill the degree. Anyways, I probably won't be running into VB for the rest of my classes so I am just curious about the value of this short experience. I don't see myself using it again. I am curious about your thoughts.
10 replies
CC#
Created by shawski. on 3/26/2023 in #help
✅ splitting project into multiple files
ive never done this before so im not sure where to begin. i am working on something and would like to split some features into multiple projects, i just dont know how. thank you!
59 replies
CC#
Created by shawski. on 2/2/2023 in #help
✅ Why am I getting this exception?
11 replies
CC#
Created by shawski. on 12/8/2022 in #help
❔ need help with a problem
using System;
using System.Collections.Generic;
using System.IO;
class Solution {
static void Main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */
int t = int.Parse(Console.ReadLine());

for (int i = 0; i < t; i++){
string s = Console.ReadLine();
for (int o = 0; o < s.Length; o++){
if (o % 2 == 0){
Console.Write(s[i]);
}
}
for (int o = 0; o < s.Length; o++){
if (o % 2 == 1){
Console.Write(s[i]);
}
}
}
}
}
using System;
using System.Collections.Generic;
using System.IO;
class Solution {
static void Main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */
int t = int.Parse(Console.ReadLine());

for (int i = 0; i < t; i++){
string s = Console.ReadLine();
for (int o = 0; o < s.Length; o++){
if (o % 2 == 0){
Console.Write(s[i]);
}
}
for (int o = 0; o < s.Length; o++){
if (o % 2 == 1){
Console.Write(s[i]);
}
}
}
}
}
I wrote this code. The input in this case was "Hacker Rank". It's supposed to output "Hce akr Rn ak". Instead, it outputted "HHHHHHaaaa". I have no idea why this happened. I must've messed up somewhere.
50 replies
CC#
Created by shawski. on 12/6/2022 in #help
✅ need help with a problem
public Person(int initialAge)
{
// Add some more code to run some checks on initialAge
if (initialAge < 0)
{
Console.WriteLine("Age is not valid, setting age to 0.");
age = 0;
}
initialAge = age;

}
public void amIOld()
{
// Do some computations in here and print out the correct statement to the console
List<int> ages = new List<int>();
ages.Add(age);

foreach (int i in ages)
{
if (i < 13)
{
Console.WriteLine("You are young.");
}
else if (i >= 13 && i < 18)
{
Console.WriteLine("You are a teenager.");
}
else
{
Console.WriteLine("You are old.");
}
}
}
public Person(int initialAge)
{
// Add some more code to run some checks on initialAge
if (initialAge < 0)
{
Console.WriteLine("Age is not valid, setting age to 0.");
age = 0;
}
initialAge = age;

}
public void amIOld()
{
// Do some computations in here and print out the correct statement to the console
List<int> ages = new List<int>();
ages.Add(age);

foreach (int i in ages)
{
if (i < 13)
{
Console.WriteLine("You are young.");
}
else if (i >= 13 && i < 18)
{
Console.WriteLine("You are a teenager.");
}
else
{
Console.WriteLine("You are old.");
}
}
}
why does it print "you are young" no matter what the input is?
41 replies
CC#
Created by shawski. on 12/4/2022 in #help
✅ runtime error
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;

class Result
{

/*
* Complete the 'plusMinus' function below.
*
* The function accepts INTEGER_ARRAY arr as parameter.
*/

public static void plusMinus(List<int> arr)
{
int positive = 0;
int negative = 0;
int zero = 0;

for (int i = 0; i > arr.Count; i++)
{
if (arr[i] < 0)
{
negative++;
}
else if (arr[i] > 0)
{
positive++;
}
else if (arr[i] == 0)
{
zero++;
}

}
Console.WriteLine(string.Format("{0.0.000000}\n", (positive / arr.Count)) + string.Format("{0.0.000000}\n", (negative / arr.Count)) + string.Format("{0.0.000000}",zero/arr.Count));
}

}

class Solution
{
public static void Main(string[] args)
{
int n = Convert.ToInt32(Console.ReadLine().Trim());

List<int> arr = Console.ReadLine().TrimEnd().Split(' ').ToList().Select(arrTemp => Convert.ToInt32(arrTemp)).ToList();

Result.plusMinus(arr);
}
}
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;

class Result
{

/*
* Complete the 'plusMinus' function below.
*
* The function accepts INTEGER_ARRAY arr as parameter.
*/

public static void plusMinus(List<int> arr)
{
int positive = 0;
int negative = 0;
int zero = 0;

for (int i = 0; i > arr.Count; i++)
{
if (arr[i] < 0)
{
negative++;
}
else if (arr[i] > 0)
{
positive++;
}
else if (arr[i] == 0)
{
zero++;
}

}
Console.WriteLine(string.Format("{0.0.000000}\n", (positive / arr.Count)) + string.Format("{0.0.000000}\n", (negative / arr.Count)) + string.Format("{0.0.000000}",zero/arr.Count));
}

}

class Solution
{
public static void Main(string[] args)
{
int n = Convert.ToInt32(Console.ReadLine().Trim());

List<int> arr = Console.ReadLine().TrimEnd().Split(' ').ToList().Select(arrTemp => Convert.ToInt32(arrTemp)).ToList();

Result.plusMinus(arr);
}
}
I made this algorithm that is supposed to receive an input and gather all the negative numbers into one variable and positive variables into another. in then divided it by the number of items in the given list.
149 replies
CC#
Created by shawski. on 12/4/2022 in #help
✅ need help with a problem
i know what im supposed to do but im having trouble implementing it. i need to add the sum of a list except for the minimum value and do the same but this time except the maximum value
170 replies