console-application

How to get system currency symbol to a string

非 Y 不嫁゛ 提交于 2020-01-13 02:52:28
问题 If I do this: Console.Write("The sum is {0:c}", 12); I'm on a Swedish computer so it'll return: The sum is 12,00 kr But is there a simple way of getting just the currency symbol, without a number? Like this (obviously this doesn't work, but just to show what I'm after): Console.Write("The symbol is {c}"); I would like that to output: The symbol is kr 回答1: This code should return the currency symbol you're looking for. System.Globalization.RegionInfo.CurrentRegion.CurrencySymbol You could also

Dijkstra's Algorithm Issue

爱⌒轻易说出口 提交于 2020-01-12 23:19:12
问题 I'm working on a program where I have to find the shortest path between 12 cities, starting in Seattle and ending in Miami. I'm using Dijkstra's Algorithm because the paths are weighted. Here is my code so far, it all works except the answer I get is not the one I need, although it is correct. This part of the code sets everything up as well as creates the sorting algorithm. class Graph { Dictionary<string, Dictionary<string, int>> vertices = new Dictionary<string, Dictionary<string, int>>();

“Ctrl + C” buttons pressed handle C# console app

不羁的心 提交于 2020-01-12 22:30:43
问题 How can I handle two buttons pressed simultaneously ('Ctrl' + 'C'), not in the WindowsForms application, but in console C# application? 回答1: I suspect you want to set Console.TreatCtrlCAsInput to true . (Assuming you don't want this to terminate the app.) 回答2: Check out Console.TreatControlCAsInput property; Gets or sets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the

Is it good to have windows service or console application?

邮差的信 提交于 2020-01-12 16:21:34
问题 I have a tasks table in my db. I want to read data from this table and run tasks. Which one is better whether to have it as windows service or a console application running. The server on which this will be run will not be shutdown 回答1: You most likely want to use a windows service. Benefits: You can control the user (and the rights associated with this user account) which starts the process An automatically started process means the desktop need to be on, not user logged, for the service to

.Net Core / Console Application / Configuration / XML

自闭症网瘾萝莉.ら 提交于 2020-01-12 14:28:33
问题 My first little venture into the .Net Core libraries using the new ConfigurationBuilder, and Options pattern. Lot's of good examples here: https://docs.asp.net/en/latest/fundamentals/configuration.html and a good copy of the example here Item 1. it says this can be used with non MVC applications, but no examples on how to use it without MVC - particularly if you are using a custom, strongly-typed class. I would like to see an example of showing the setup of DependencyInjection, Configuration,

.Net Core / Console Application / Configuration / XML

◇◆丶佛笑我妖孽 提交于 2020-01-12 14:28:06
问题 My first little venture into the .Net Core libraries using the new ConfigurationBuilder, and Options pattern. Lot's of good examples here: https://docs.asp.net/en/latest/fundamentals/configuration.html and a good copy of the example here Item 1. it says this can be used with non MVC applications, but no examples on how to use it without MVC - particularly if you are using a custom, strongly-typed class. I would like to see an example of showing the setup of DependencyInjection, Configuration,

How do I call main() in my main cpp file from a seperate cpp file?

左心房为你撑大大i 提交于 2020-01-11 14:53:12
问题 I'm making a class that displays a message to the user and asks them if they want to return to the start of the program, but the message function is in a separate class from where my main() is located. How do I access the main() function from a different class? This is an example of the stuff I want to do: main.cpp file: int main() { Message DisplayMessage; DisplayMessage.dispMessage(); return 0; } Message.cpp file: void dispMessage(void) { cout << "This is my message" << endl; //now how do I

How to iterate through a column in an Excel application through C# Console?

蓝咒 提交于 2020-01-11 10:58:25
问题 I have created a Console Application that reads from an Excel file. I want to take all of the document numbers and place it in an array for searching purposes. I am able to find the cell that contains the data "DocumentNumber" e.g. $F$5. How can I iterate through rows within column F? I have the following code: public static void Main(string[] args) { string address; string next; try { Excel.ApplicationClass excel = new Excel.ApplicationClass(); Excel.Workbook workbook = excel.Workbooks.Open(

How to iterate through a column in an Excel application through C# Console?

♀尐吖头ヾ 提交于 2020-01-11 10:58:11
问题 I have created a Console Application that reads from an Excel file. I want to take all of the document numbers and place it in an array for searching purposes. I am able to find the cell that contains the data "DocumentNumber" e.g. $F$5. How can I iterate through rows within column F? I have the following code: public static void Main(string[] args) { string address; string next; try { Excel.ApplicationClass excel = new Excel.ApplicationClass(); Excel.Workbook workbook = excel.Workbooks.Open(

Command prompt messed up after running a Python program

别来无恙 提交于 2020-01-11 07:44:05
问题 The code below creates a layout and displays some text in the layout. Next the layout is displayed on the console screen using the raw display module from the Urwid library. (More information on my complete project can be gleaned from questions at Required widgets for displaying a 1D console application and Using Urwid to create a 2D console application . My skype help request being here. I can run the code to display the relevant information. On pressing F8 the code asks a dialog on screen