|
boolSet should hold weather or no each array has been chosen.
Example in an array of 5 and the numbers 1 2 3 5 were chosen then...
0 = False, 1 = False, 2 = true, 3 = True, 4 = False, 5 = True
so the program will show on the Console Write line 1 2 3 5
SO I have random numbers from 0 to 100 chosen in order to create 2 separate sets.
Then the user must insert 3 numbers to create a userSet. This is where I am having problems. If the user stays in range ect. then it works fine. But when he/she doesn't... well... I get out of bounds error. I know there must be an easier way of doing it... but I really don't have any experience
|
|
|
|
|
I see. It should be a fairly easy fix then. (although you have some other problems in your user input code)
The easiest way to fix the crash is to remove the else block completely. Think about it, if intSet[i] is not between 0 and 100 there is not an entry in the boolSet array to hold the information, and in fact you don't need one if you only care about the numbers 0 to 100 anyway!
The best way with your current code would be to have all the elements in boolSet set to false to start with then let the code you already have set to true the ones the user entered.
For the problems with your input code, try entering 1, 2, d.
Also if you have the requirements from the assignment posting them here (or the relevant parts) would give us a clear idea of what you have to achieve. (note I have no intention of doing your homework for you but im quite happy to you help you with problems as you have been doing the work yourself so far! )
|
|
|
|
|
yea I figured that,
there are two parts, the first part...
Write a class that will be used for creating sets of whole numbers in the range of 0…100. Implement the sets with a Boolean array. Define in the class the following operations:
1. A constructor without parameters, which initialize the set as an empty set.
2. A constructor that gets an array of wholes and creates a set that contains those array members.
9. Override the methods ToString and Equals that inherit from Object in the following way:
10. ToString – will return a string representation of the set.
Part two is where the user comes in
Write a program that checks the sets class in the following way:
• Create 2 sets by drawing 10 random numbers in the range of 0…100 for each set, and display the sets contents.
• Perform intersection and union of the two sets and display the received sets.
• Get from the user 3 numbers and create a third set. Check whether this set is a sub-set of one of the sets and display the result.
I am also having problems that after I create union and intersection, there is only one set and not two and the originals die...
I haven't played around with that yet so not going to ask for help with it yet.
|
|
|
|
|
Looks like an interesting assignment. Are you still having problems with the previous bits?
|
|
|
|
|
nah, don't have a problem with the strange 0, for some reason its not there anymore.
|
|
|
|
|
found another issue... I insert 3 6 fg and get an output of 4 7....
|
|
|
|
|
Im guessing you had been round the for loop a couple of times before you put the right input in?
I would suggest scrapping the user input code and starting again, sometimes its easier than fixing something.
You might want to break it down into smaller chunks, i.e get the input and store as a string, then try parsing it to an int and then if that works add it to the array, if not ask the user again. Repeat the above 3 times and bingo!
The code will be more verbose but it will be easier to debug and understand and once you have it working you can always go back over it and refactor it.
Terse code can look better but it can also be hard to understand and maintain.
|
|
|
|
|
I will do just that...
Going to go to the school and see if I can work on it there and get some more help.
Thanks everyone for trying to help me out, if anyone else can help out still that would be great, will pop in here often, C# is killing me
|
|
|
|
|
You'll get your head round it eventually! Its just a matter of getting used to the way of thinking. I'm assuming this is your first programming language?
|
|
|
|
|
we learned C and C++ but I was never very good at it, and every time we learn a new language the problems become more difficult. Also, we only study each language up to 2 or 3 months, its a 2 year college.
|
|
|
|
|
well, thanks to everyone for their help, I finished the assingment and now just hoping I did it well...
got things done easier but don't think it was a very efficiant way.
well, lets hope for the best
|
|
|
|
|
Hi all
I am trying to understand the Evidence class, but I am missing some point.
If I use the AddAssembly() method below in the main of my program,
am I supposed to expect to have my program signed with that strong name?
What's main use case for Evidence class?
Thanks
Mn
<br />
string sPubKeyBlob = "00240000048000009400000006020000" +<br />
"00240000525341310004000001000100" +<br />
"19390E945A40FB5730204A25FA5DC4DA" +<br />
"B18688B412CB0EDB87A6EFC50E2796C9" +<br />
"B41AD3040A7E46E4A02516C598678636" +<br />
"44A0F74C39B7AB9C38C01F10AF4A5752" +<br />
"BFBCDF7E6DD826676AD031E7BCE63393" +<br />
"495BAD2CA4BE03B529A73C95E5B06BE7" +<br />
"35CA0F622C63E8F54171BD73E4C8F193" +<br />
"CB2664163719CA41F8159B8AC88F8CD3";<br />
Byte[] pubkey = HexsToArray(sPubKeyBlob);<br />
<br />
StrongName sn = new StrongName(<br />
new System.Security.Permissions.StrongNamePublicKeyBlob(pubkey),<br />
"Manu",new Version(2,1,1,0));<br />
<br />
object[] z = new object[]{ <br />
new Zone(SecurityZone.Internet), sn };<br />
Evidence ev = new Evidence();<br />
ev.AddAssembly(z);<br />
|
|
|
|
|
|
Hi,
I have 2 machine which is in LAN. 1st Machine is Admin and other machine is Customer. There is one online application where SuperAdmin create the user Admin and assign access rights to Admin.
When Admin connect to online application it is using username and password to connect to online application which is created by SuperAdmin. Admin has its own control panel where he can create user and assign username and password to his(Admin's) user which is in LAN.
At the Admin Side one windows application is used where onle Admin can connect to online applications database. If his subuser login he dont have access to connect to the online applications database. At the admin side there is no database. Admin can connect to the online database,get the required details and stored it into cache.
Here Admin's User(subuser) can access the cache data,modify or delete the data and again store it into the cache. So that once the operation completed it will store it into the cache and then update the online database.
Admin's user connect to admin's compuer through LAN only and only Admin can connect to the online database.
Now I want Solution for that where I dont want to use any database at the Admin's position. Admin can access the online database using web service.
but for his user want to setup cache(or any other solution) so that his user can access the data.
That is my scenario is there is main online database where admin use his data and that is share with his user. His user don't have any access to the online database.
So how can i use cache on the admins subusers side. How can i access cache data.
Thanks
sjs4u
|
|
|
|
|
Hi,
so if I understood you correctly, you need something providing data (without database) at the admin side. What about storing an XML file? Or think about extending the webservice to handle with different roles (superadmin, admin and subside admin).
Regards
Sebastian
P.S.: But I would choose to build a local database...
|
|
|
|
|
Thanks for the reply.
At the admins computer he can able to connect to the online database and stored it into the cache but his user/subusers can only use cache or any other solution for that.
Thanks
sjs4u
|
|
|
|
|
Hello, I have an errand to use a C++ written library in C# project.
That's why I need to make a wrapper or anything to do with it.
The library is MCU for PolyCam, it came out with includes (.h files), Release folder with 3 .lib files and 1 .dll files.
I've asked Mr.Google for this problem and many people told me about P/Invoke (DllImport), C++/CLI, and more, but the problem is that I don't have an example to do this. The example I have from P/Invoke is only from a single .dll, but in my case, I have a whole library (.h, .lib, .dll) with me.
So, I want to ask how to make a wrapper from C++ library to C#.
Thanks in advance.
|
|
|
|
|
|
I've read the link before, but many links only use 1 .dll, whilst I have a set of 3.lib, a folder of .h and 1 .dll, will they differ each other?
Well, I haven't tried it yet though.
|
|
|
|
|
The chances are (in my experience) that the dll will have all the functions etc you need. The h files(s) will have the function prototypes and structs that will be needed to use the functions in the dll.
Examine the header files and replicate/wrap what you see in them and use what you have to call using PInvoke the functions in the dll and you should pretty much have your wrapper.
Examining the h and lib files with notepad should be enough to get underway.
|
|
|
|
|
hi.
i make a InOut Time report which have 3 parameters (1) employe id # (2) todate (3)fromdate;
i select employe id "111" , todate(1-sep-2009) and fromdate(09-sep-2009) report show all data of employe of given date like this..
ATT_DATE ID TIMEIN
1 Sep 09 111 8:22
3 Sep 09 111 8:24
4 Sep 09 111 8:15
6 Sep 09 111 8:25
7 Sep 09 111 8:22
9 Sep 09 111 8:24
one problem in my report is that 2 sep,5 sep and 8 sep is not shown in my report becouse employe is absent in these days. i want to show all date 1 sep 2009 to 9 sep 2009.
hope u understand my question
thanks in advance
jawad kahtri
|
|
|
|
|
Your question makes no sense. Your todate is later than your from date, I assume this is a typo. I assume your report is returning exactly what you asked for. You seem to be saying that you want to show dates even if the employee was not there, then. So, you need to write code that will do that. I'm not sure what sort of response you were expecting, we can't fix your code without seeing it, and it's obvious that you need to change how the code works to get the date range the way you want it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I am assuming you are looking for a query (and therefore this should have been asked in the General Database forum) in sql.
Select the dates between 1/sep and 9/sep (probably insert then into a table variable would be easiest) then do a left join from the date table to your timereport table, this will show all the dates and the attendance records.
|
|
|
|
|
in a DataGridView can each row bind to a different custom data source ((BindingList)) ?
|
|
|
|
|
No. The point of a databound control is to bind to a data source. You'd have to create a custom data source that grabbed data from the different sources you want to use.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|