console-application

Bankteller console application

三世轮回 提交于 2020-01-01 07:24:29
问题 I'm making a simple application to simulate the bankteller problem . What I'm trying to simulate is: You have 4 counters in a store. 1 counter is open. Customers start coming in and enter the line for the first counter. When the fourth customer enters the line for the first counter, another counter should open. The line should be equally divided between the 2 counters.When the customer at the second counter is helped and no new customers enter the line, the counter should close. Basically 4

Is there a better way to remove all of the three buttons on the title-bar and remove the scroll-bar using Windows API?

夙愿已清 提交于 2020-01-01 06:54:43
问题 The code removing all of the three buttons on the title-bar and removing the scroll-bar I use in "Windows 7" so far is listed: #define WINVER 0x0501 // WinXP and UP #include <windows.h> int main ( void ) { //Get a console handle HWND ConsoleWindow = GetConsoleWindow(); //Change Settings SetWindowLong (ConsoleWindow, GWL_STYLE, WS_THICKFRAME); SetWindowLong (ConsoleWindow, GWL_STYLE, WS_CAPTION); SetWindowPos (ConsoleWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_SHOWWINDOW); /

Why does Console.Readline() have a limit on the length of text it allows? [duplicate]

血红的双手。 提交于 2020-01-01 04:31:09
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Console.Readline() max length? In my attempt to find a very simple text to speech application I decided it was faster to write my own. I noticed, however, that Console.Readline() is limited in the amount of text it allows per line to 254 characters; I can't find anything about this limit in the method documentation. Is this a limitation in the Windows stack, or a problem with my code? How can I overcome it? I

Change icon for a Delphi console application

梦想与她 提交于 2020-01-01 02:35:15
问题 How do I change the program icon for a Delphi console application? The application settings is greyed in a console application. Bye. 回答1: According to a July 2007 blog article by Nibu Thomas, there seems to be a SetConsoleIcon WinAPI function. Alternatively just put the icon in a resource file. Windows should use the first icon it encounters in the application's resources as the application icon. 回答2: If the option to change the icon is disabled, then it is because you have deleted or

How to keep switch statement continuing in Java

三世轮回 提交于 2019-12-31 06:54:27
问题 I'm looking to keep the following menu repeating: Choose an Option 1 - FIND 2 - IN-SHUFFLE 3 - OUT-SHUFFLE So that when a user selects an option (and this will be executed), afterwards they can select other options as well. Problem: My code keeps the menu repeating without stopping. import java.util.Scanner; public class MainMenu { public static void main(String[] args) { int userChoice; userChoice = menu(); } private static int menu() { Scanner scanner = new Scanner(System.in); System.out

How to call an appropriate method by string value from collection?

自作多情 提交于 2019-12-31 06:25:14
问题 I have a collection of strings. For example, string[] coll={"1", "2", "3" ..."100"..."150"...} and I have respective methods for the string collection such as void Method1, void Method2, void Method100 I select appropriate method like that: string selector=string.Empty; switch(selector) { case "1": MethodOne(); break; ........ case "150": Method150(); break; } The above code is really bored and I will have more string elements in the string collection {"150" ... "250"...}. How to make like

What happened to the context menu in my console application?

只谈情不闲聊 提交于 2019-12-31 03:01:04
问题 Was creating a simple console application to do some prototyping and was shocked to see that the right-click/context menu is missing from a standard .NET console app! I'm unable to find any information about this, and intellisense isn't helping. So what happened to it? Can I get it back? And if not, how can I configure my console application to treat ctrl-c/ctrl-v as standard? 回答1: Context menu doesn't show up when you right click on the console app body (not the title bar) when VS debugger

C# Getting strange results for a simple math operations

拈花ヽ惹草 提交于 2019-12-31 00:50:53
问题 I have noticed for some strange behavior while adding two doubles, sometimes it works correct, and sometimes not! Here is the first example: double num1 = 0.1 + 0.7; //Guess the result? Easy - 0.8 !!! or not? Look at the strange result: And guess what, the if statement is going inside the else block, and prints the num1 - and no, it doesn't prints 0.799999999999993, it prints 0.8. So I have gone one more step forward and tried this code: if (0.1 + 0.7 == 0.8) //Returns false ?? { Console

C++ how do I terminate my programm using ESC button

被刻印的时光 ゝ 提交于 2019-12-30 11:09:24
问题 Here is my main function i use visual studio 2012 express and the code works fine. My question is how will i terminate this loop when the user Presses the ESC button instead of -1. Although i would prefer a solution that works both in unix and windows, if it is not possible i am most interested in it working for windows. int _tmain(int argc, _TCHAR* argv[]) { list mylist; int value; cout<<"Give the numbers you want to insert to the list, press -1 to stop\n"; do { cin>>value; mylist.insertf

What makes an app console or Windows Form application?

六月ゝ 毕业季﹏ 提交于 2019-12-30 07:59:35
问题 [Visual Studio 2008] I created a new project for console application and modified it to look like this: class Program { static void Main (string[] args) { Thread.Sleep (2000); } } Then I created another project for Windows Form application and modified it: static class Program { //[STAThread] commented this line static void Main (string[] args) { //Added args //Commented following lines //Application.EnableVisualStyles (); //Application.SetCompatibleTextRenderingDefault (false); //Application