|
Eddy Vluggen wrote: Visual Basic is the way to go. Lots of examples out there, including psychology tests. Question 1: What possessed you to choose Visual Basic? 
|
|
|
|
|
Everone knows that C# is better for 11 questions or more. For 10 and lower, we use VB.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I'm not a beginner by any means. I done a lot of console programming. I will probably use a console program as a prototype for the Windows version.
But you're right. Either language will work just fine.
|
|
|
|
|
Don't use a console program as a prototype: the two operate completely differently. The console is functional programming, where the app determines what is to happen at any time. The Windows version is event driven, where the user (and to an extent the data) determines what is to happen when. Trying to write a windows program as if it was a console app will not work at all well.
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I'd recommend Windows Forms / C#: you have a great IDE, Visual Studio, all the essentials for single-inheritance OOP (with Interfaces to kind-of implement multiple inheritance), and a time-tested (albeit quirky) set of useful controls ... and the ability to create custom controls, or controls that inherit from (and modify) the native controls.
I think that once you get going with these tools, you'll feel like your days in console programming were a jail sentence
cheers, Bill
«... thank the gods that they have made you superior to those events which they have not placed within your own control, rendered you accountable for that only which is within you own control For what, then, have they made you responsible? For that which is alone in your own power—a right use of things as they appear.» Discourses of Epictetus Book I:12
|
|
|
|
|
Well, in my opinion, you would find it easier to prototype things with C#, you could always port your code to C++ or even C if you need to for optomization reasons. Visual Studio can be downloaded for free, though it doesn't have all the useful libraries to make absolutely everything easier. If you go with Winforms at first you will not have to do any ASP.NET back-coding for the GUI, that can save a lot of time.
The reason I suggest C# is that it is Strongly Typed and Type Safe making it much easier to debug than a language like Java.
|
|
|
|
|
Member 12974235 wrote: My question is which language and IDE do you think would be easier to get this done?
No language at all.
There are internet services that already do that. They provide a way for you to write questions, provide a form for the answer, and probably even grading. I suspect some are even free.
|
|
|
|
|
Well, first of all hello to everyone reading my question.
Question:
I am supposed to write a program in console version of c# in vs2015 for training purposes, this is the app (Class Score Average Calculator):
Code an app that grabs score and its multiply and shows the average.
ex.
score 19 multiply 2 and 2nd Score 18 | multiply 1
Average = ( (19*2)+(18*1) ) / (2+1)
Average = ( (Score1*Mul1) + (Score2*Mul2) + .... + (Score n.Mul n)) / (Sum of Multiplies)
****problem , there is no limit to the course scores (The user can input like 50 scores)
|
|
|
|
|
And how would that cause a problem? Most programs accept an undefined number of inputsL a Word document can hold any number of pages, this forum can hold any number of posts, etc.
You have to create a loop to accept and process some input, and a convention as to how you signify the end of the input. In this case (console app not having menus and mouse input) you could use a convention such as "multiplicity zero signals the end" and hence causes the loop to be exited.
If you need all the data before you can start your calculations, then you also need an "elastic" data structure to hold the inputs (a List could do). Are you sure a simple average can only be calculated once all the data is available? look at your formula...
|
|
|
|
|
THAT IS exactly the challenge i am running into, defining new holders everytime the loop runs and put them automatically in formula
I guess this is something really high level for me as a rookie programmer
|
|
|
|
|
Just to add to what Luc said: We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.
Start by concentrating on two things: The lack of a limit, and the input of numbers. The first - as Luc suggests - is handled with a List<T> List(T) Class (System.Collections.Generic)[^], by asking the user how many entries he wants and allocating an array big enough, or by using a "running total" and a count. The second is just a case of using the appropriate TryParse method to convert a string to an integer or floating point value.
Try it yourself, you may find it is not as difficult as you think!
If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Oh I got it can I have your email to send the final screenshot for you and more help?
ps. I am NOT looking for you to write my program. I want guidance on how to wrtie it
|
|
|
|
|
Nope! I get enough emails every day already...
And all assistance here is public: that way everybody benefits, not just the original poster.
Sent from my Amstrad PC 1640
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Generics are a relatively advanced concept for a new programmer and should not be needed for such a simple problem. I suggest going to your local library and see if you can get a book like this:
Learning C# 2005, Second edition by Jesse Liberty and Brian MacDonald. Copyright 2006 O'Reilly Media, Inc, 0-596-10209-7.
or "C# for Dummies" don't be fooled by the title, it is a good book for learning C#.
|
|
|
|
|
You do realise you replied to OG and not the original poster!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Not overly relevant since it is easy to browse replies and see what useful information might be present.
|
|
|
|
|
Create a local variable to keep track of how many times you've gone through the loop, and another variable for a summing all the scores each time through the loop.
Then just divide the sum by the number of times through the loop, and you have the average.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
This is my code which is not returning data as per my requirement. So please rectify my code which will give me the desired output.
static void Main(string[] args)
{
List<int> test1 = DivideInt(10,1).ToList().OrderBy(s=> s).ToList();
List<int> test2 = DivideInt(10, 2).ToList().OrderBy(s => s).ToList();
List<int> test3 = DivideInt(10, 3).ToList().OrderBy(s => s).ToList();
List<int> test4 = DivideInt(10, 4).ToList().OrderBy(s => s).ToList();
List<int> test5 = DivideInt(10, 5).ToList().OrderBy(s => s).ToList();
List<int> test6 = DivideInt(10, 6).ToList().OrderBy(s => s).ToList();
List<int> test7 = DivideInt(10, 7).ToList().OrderBy(s => s).ToList();
List<int> test8 = DivideInt(10, 8).ToList().OrderBy(s => s).ToList();
List<int> test9 = DivideInt(10, 9).ToList().OrderBy(s => s).ToList();
List<int> test10 = DivideInt(10, 10).ToList().OrderBy(s => s).ToList();
}
public static IEnumerable<int> DivideInt(int pagetotal, int userinput)
{
if(userinput==0)
{
yield return 0;
}
else
{
int rest =pagetotal % userinput;
double result =pagetotal / (double) userinput;
for(int i=0; i< userinput;i++)
{
if(rest-- >0)
yield return (int) Math.Ceiling(result);
else
yield return (int) Math.Floor(result);
}
}
}
My requirement as following.
1) if total page is 10 and user split into 2 files then two files will be generated each file will have 5 pages
2) if total page is 10 and user split into 3 files then 3 files will be generated. first 2 files will have 3 pages and last pages will have 4 pages.
3) if total page is 10 and user split into 4 files then 4 files will be generated. first 3 files will have 3 pages and last pages will have 1 pages.
4) if total page is 10 and user split into 5 files then 5 files will be generated. each files will have 2 pages
5) if total page is 10 and user split into 6 files then first 5 files will be generated with 1 page. last file will have 5 pages
6) if total page is 10 and user split into 7 files then first 6 files will be generated with 1 page. last file will have 4 pages.
7) if total page is 10 and user split into 8 files then first 7 files will be generated with 1 page. last file will have 3 pages.
8) if total page is 10 and user split into 9 files then first 8 files will be generated with 1 page. last file will have 2 pages.
8) if total page is 10 and user split into 10 files then 10 files will be generated with 1 page.
again
1) if total page is 9 and user split into 2 files then first file will be generated with 4 page. last file will have 5 pages.2) if total page is 9 and user split into 3 files then each 3 files will have 3 pages.
3) if total page is 9 and user split into 4 files then first 3 files will have 2 pages and last page will have 3 pages.
4) if total page is 9 and user split into 5 files then first 4 files will have 2 pages and last page will have 2 pages.5) if total page is 9 and user split into 6 files then first 5 files will have 1 pages and last page will have 4 pages.
6) if total page is 9 and user split into 7 files then first 6 files will have 1 pages and last page will have 3 pages.
7) if total page is 9 and user split into 8 files then first 7 files will have 1 pages and last page will have 2 pages.
8) if total page is 9 and user split into 9 files then each file will have 1 pages.
Hopefully I am clear what I am looking for.
The output i am getting from my program.
Here i am mentioning what kind of output i am getting from above code and what kind of i am expecting.
1) List test4 = DivideInt(10, 4).ToList().OrderBy(s => s).ToList(); output is getting 2,2,3,3 but output should be 2,2,2,4
2) List test6 = DivideInt(10, 6).ToList().OrderBy(s => s).ToList(); output is getting 1,1,2,2,2,2 but output should be 1,1,1,1,1,5
3) List test7 = DivideInt(10, 7).ToList().OrderBy(s => s).ToList(); output is getting 1,1,1,1,2,2,2 but output should be 1,1,1,1,1,1,4
4) List test8 = DivideInt(10, 8).ToList().OrderBy(s => s).ToList(); output is getting 1,1,1,1,1,1,2,2 but output should be 1,1,1,1,1,1,1,3
5) List test9 = DivideInt(10, 9).ToList().OrderBy(s => s).ToList(); output is getting 1,1,1,1,1,1,1,1,2 but output should be 1,1,1,1,1,1,1,1,2
please guide me what to change in routine DivideInt() thanks
modified 12-Aug-18 12:10pm.
|
|
|
|
|
I would define the number of groups then add the pages to the groups, then add the remaining pages to the groups starting at group 0. The I would go get the integers for each page in each group.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I'm confused, your code is implementing something that is harder than what your requirements stipulate, assuming I understood them correctly, as in: generate N positive integers totalling SUM, where the first N-1 numbers are identical and maximal.
If so, this would be the "algorithm" for N>0 and SUM>=0:
for(int i=0; i<N-1; i++) yield return SUM/N;
yield return SUM-SUM/N*(N-1);
As this is an integer problem, no doubles are involved; for positive numbers integer divide returns the (floored) quotient.
Further comment: I see no need to order the list as you do, and if you really want a List<int> then why do you use IEnumerable.ToList, your method could create a List<int> straight away...
|
|
|
|
|
How can I get meta data of any given file in asp.net core
|
|
|
|
|
It depends on the file type and where it stores its meta data. Please edit your question and provide proper details of your problem.
|
|
|
|
|
Hi, i've got a listbox that populates with servers trough an LDAP query
when doublclicking on a server a tab is created with an RDP session
this works perfectly to create the RDP
is there a way that i can close the tabs and disconnect that active rdp session?
right now it only closes the tab but the session remains active.
i'm using
AxMsRdpClient9NotSafeForScripting
thanks
|
|
|
|
|
I love the name of the control you are using in your script
Can't you detect the onclosing event of the tab and kill the RDP session in that event or do you mean you can't kill the session from c#!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
this is what happends when the new tab is created
TabPage page = new TabPage(lbServers.SelectedItem.ToString());
page.Name = lbServers.SelectedItem.ToString();
tabControl1.TabPages.Add(page);
tabControl1.SelectedTab = page;
AxMsRdpClient9NotSafeForScripting rdpWindows = new AxMsRdpClient9NotSafeForScripting();
rdpWindows.Dock = DockStyle.Fill;
page.Controls.Add(rdpWindows);
rdpWindows.AdvancedSettings9.NegotiateSecurityLayer = true;
rdpWindows.AdvancedSettings9.SmartSizing = true;
rdpWindows.Domain = txtDomain.Text;
rdpWindows.UserName = txtUser.Text;
rdpWindows.AdvancedSettings9.ClearTextPassword = txtPass.Text;
rdpWindows.Server = page.Name;
rdpWindows.Connect();
as the tabs name contains the RDP server name i tough i would be able to properly close the connection that way but somehow it doesn't work.
|
|
|
|
|