kiran
kiran
CC#
Created by kiran on 11/2/2023 in #help
please help homework due in 20 mins
Program Description: You are to read an external file of random integer values until the end of file is found. As you read the file you should determine how many numbers are less than the value 500 and how many numbers are greater than or equal to 500. Statements Required: external file input, output, loop control, decision making Data Location: Program 215a.txt Sample Output: The number of numbers less than 500 is 192 The number of numbers greater than or equal to 500 is 208 The total number of numbers is 400 DATA: 123,54,67,38,875,43,88,222,35,677,84,10,32,1,500,7,543,678,94,23,754,32,500,654,861,23,56,77,98,95,4 8,78,64,222,467,871,983,816,278,632,754,8,7,234,654,691,455,987,123,1,45,543,67,23,45,6,982,8,95,743 ,5,982,4,0,29,584,357,94,385,72,394,570,98,5,3,6,9,5,6,500,3,402,1,809,2,43,587,234,888,356,807,2,3,45, 98,777,458,72,357,823,45,723,911 MY CODE: using System; using System.Runtime.CompilerServices; namespace countingnumebrs // Note: actual namespace depends on the project name. { internal class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); string data = ("215a.txt"); string[] num ; StreamReader myreader = new StreamReader(data); string massimo = myreader.ReadLine(); num = massimo.Split(","); int less = 0; int moreequal = 0; int total = 0; for (int i = 0; i < num.Length; i++) { if (Convert.ToInt32(num[i]) < 500) { less++; } else if (Convert.ToInt32(num[i]) <= 500) { moreequal++; } total++; } Console.WriteLine("there are {0} numbers less than 500\nthere are {1} numbers more or equal to 500\nthere are {2} numbers total", less, moreequal, total); } } }
10 replies
CC#
Created by kiran on 12/8/2022 in #help
❔ fullscreen console
is there a way i can make the console fullscreen? like Console.windowheight = fullscreen; or something does that exist?
25 replies
CC#
Created by kiran on 12/3/2022 in #help
❔ Blackjack card randomizer
public static void Blackjack() { Console.Clear(); int card1 = 0; int card2 = 0; int card3 = 0; while (true) { Random random1 = new Random(); card1 = random1.Next(1, 11); Random random2 = new Random(); card2 = random2.Next(1, 11); Console.WriteLine("your cards: {0} and {1}", card1, card2); Console.WriteLine("do you want another card? y/n"); string hitstand = Convert.ToString(Console.ReadLine()); hitstand = hitstand.ToLower(); if (hitstand == "y") { Random random3 = new Random(); card3 = random3.Next(1, 11); } else if (hitstand == "n") { int cardtotal = card1 + card2 + card3; bjMath(cardtotal); } } i want to give the user 2 cards to begin with and they can keep picking cards that are random 1-10 ty 🙂
11 replies
CC#
Created by kiran on 12/1/2022 in #help
✅ Why is rng not working?
https://docs.google.com/document/d/1r9a7-K_GiWhBarvFvC_fvRdVF9cziu05_HXtAk1gu_k/edit?usp=sharing The dice only rolls 2 and 2, please help its due friday, making casino game craps
8 replies