What data type to use?

I need to compute the percentage of each INTEGER, say, 4,5,6,3,2. So this is what I did:
percent_value[] = (value[] / total) * 100;
both percent_value and value[] are int arrays.
I know there's something wrong, I don't know what... please help :)

If total is an int, then you will always get 0 (or 100) the way you calculate it, since dividing two ints will produce an int, not a float. So you should multiply with 100 before you divide with total.
You need a for-loop to work with your arrays:
for (int x = 0; x < value.length; x++) {
  percent_value[x] = value[x]*100/total;
}I assume that was what you were trying.

Similar Messages

  • What data type is used for storing password,

    What data type is used for storing pass word in oracle db, i mean if user inputs some thing from forms it should be in Encrypted form in db, please any help??
    Thank you
    Hina

    Data type is VARCHAR2:
    SQL> desc dba_users;
    Name                                      Null?    Type
    USERNAME                                  NOT NULL VARCHAR2(30)
    USER_ID                                   NOT NULL NUMBER
    PASSWORD                                           VARCHAR2(30)
    ACCOUNT_STATUS                            NOT NULL VARCHAR2(32)
    LOCK_DATE                                          DATE
    EXPIRY_DATE                                        DATE
    DEFAULT_TABLESPACE                        NOT NULL VARCHAR2(30)
    TEMPORARY_TABLESPACE                      NOT NULL VARCHAR2(30)
    CREATED                                   NOT NULL DATE
    PROFILE                                   NOT NULL VARCHAR2(30)
    INITIAL_RSRC_CONSUMER_GROUP                        VARCHAR2(30)
    EXTERNAL_NAME                                      VARCHAR2(4000)
    PASSWORD_VERSIONS                                  VARCHAR2(8)
    EDITIONS_ENABLED                                   VARCHAR2(1)
    AUTHENTICATION_TYPE                                VARCHAR2(8)You can use SQL function ORA_HASH to hash password: http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions124.htm#SQLRF06313.

  • What message type to use for syndicating data back to R3 from XI

    What message type to use for syndicating data back to R3 from XI. It gives a Message type IDOC error code 51.

    Hi Rehman,
    You are getting error 51 which means "Error: Application document not posted".
    This might because of two reasons:
    1. Your IDoc doesn't contains all the mandatory fields required by the inbound function module to post the IDoc.
    2. You have assigned wrong inbound function module to post the IDoc.
    Please check these cases.
    Hope this will help you.
    Thanks,
    Shiv Prashant Dixit

  • What data type I can use if the text is more then 4000 varchar?

    Dear all,
    What data type I can use if the text is more then 4000 varchar?
    Please advice,
    Amy

    You didn't specify if you are referring to tables or code.
    In tables the limit is varchar2(4000) so anything bigger will need to be stored in a CLOB (as already mentioned).
    In PL/SQL code you can defined varchar2 up to 32K so varchar2(32767).
    ;)

  • I want to add image in column is it possible then how to add image in data base what data type we need to do

    I want to add image in column is it possible then how to add image in data base  what data type we need to give we required any casting  please show me one example
    jitendra

    Hi again,
    Several points that can help more:
    1. If you are working with Dot.Net, then I highly recommend read the first link that you got! This is nice and simple coding. Another option is this link which is even better in my opinion:
    http://www.dotnetgallery.com/kb/resource21-How-to-store-and-retrieve-images-from-SQL-server-database-using-aspnet.aspx
    2. As i mention above both link use the column's type image. There are several other option of working with Files. In most of my applications architecture I find that it is better to use a column which let us use any type of file and not an image column.
    In choosing the right column's type for your needs basically your fist question should be if if you want to store your data inside relational database environment or outside relational environment. It is a good idea to look for blogs on this issue. Next
    if you chose to store your data inside then you need to chose the right column type according to your server version. I highly recommend to look for blogs on the differences between those column's types: IMAGE, 
    Check those links:
    To BLOB or Not To BLOB: Large Object Storage in a Database or a Filesystem
    http://research.microsoft.com/apps/pubs/default.aspx?id=64525
    FILESTREAM feature of SQL Server 2008
    http://msdn.microsoft.com/library/hh461480
    FileTables feature of SQL Server 2012
    http://technet.microsoft.com/en-us/library/ff929144.aspx
    Compare Options for Storing Blobs (SQL Server)
    http://technet.microsoft.com/en-us/library/hh403405.aspx
    Binary Large Object (Blob) Data (SQL Server)
    http://technet.microsoft.com/en-us/library/bb895234.aspx
    Managing BLOBs using SQL Server FileStream via EF and WCF streaming
    * Very nice tutorial!
    http://petermeinl.wordpress.com/2012/02/20/managing-blobs-using-sql-server-filestream-via-ef-and-wcf-streaming/
    [Personal Site] [Blog] [Facebook]

  • What connector type is used to plug a guitar into the iPad?  Does it connect to the earphone jack?

    What connector type is used to plug a guitar into an iPad?  Does it connect to the earphone jack?

    Actually you can get something like this from your local mac store. http://www.ikmultimedia.com/products/irig/ It plugs right into the earphone jack and works fine (I own this model and it works well on the go). For my actual mac, I use a Monster iStudioLink, which I have heard will work with the iPad 2 (but with some bugs - see the comments on the Monster website) http://www.monstercable.com/productdisplay.asp?pin=2440

  • Display as is having what data type?

    Hi Friends,
    I have an item in page and i have selected that item as display as. Then what data type it contains by default.
    Regards

    Hi,
    It can be of any type and it will accept all the data types, because this item is not related to the table.
    Since this item type will be of Static text with session state substitutions and it doesnt matter of any datatypes.
    What is the necessary of this question???
    Regards,
    Mini
    Mark Answers Promptly

  • What data type do I use in MSA to handle CRM DEC data?

    Dear Geeks,
    We have a customer field 'ZZ_SUPPORT' on CRM (40 SP11) opportunities, which we flow
    down to mobile sales. It previously carried a NUMC2 value (a number
    from 1 - 99), and this worked fine... the data flowed fine in both
    directions. The data element ZZ_SUPPORT used in CRM is based on a newly
    created data domain called Z1_TO_99 and this was defined as data type NUMC
    (2 characters), which we have changed to DEC (4 characters, and decimal
    places 2, and screen display5). Having made this change and also
    changed the screen layout in SE51, the field now looks good and takes
    a value like '12.34' without error. We can also see the '12.34' value
    being carried in the Opp_Write Bdoc in SMW01 classic segment. However, the BDoc does not migrate
    successfully to Mobile - the ZZ_Support value is lost. In Mobile, I
    have genereted the Tables associated with Opportunity_write, and also
    the BDoc, and I have also changed the BOOPPORTUNITY / Y_Support field
    (which carries the value) from NUMC2 to String5. I have also tried Long5, and currency4
    because there is no data type "DEC" available in Mobile. When I send
    opportunity messages up from Mobile to CRM, I see them going into SMQ2
    and then they dissappear because the Function module cannot handle the
    BDoc. What is the problem? Is it the function module? or the data type
    used on Mobile - if so what should I use in the absense of "DEC"?
    Richard

    Sounds like a strange issue indeed. I would call Johnny Nobles.
    Tx: Smoggen ?
    Sorry, can't come up with better ideas.
    Cheers,
    Seb.

  • Smart Album : Inconsistency in the Date Type format used inside Aperture ?

    Hello,
    After using Aperture 2.0 for some days, I tried to create a Smart Album using as creation option for the Album the Date + "is in the Range" option which is leaving two blank fields for filling the two dates which are supposed to be the date limits of the pictures that the user wants to select.
    My OS X is set to the italian language so our date format is the dd/mm/yy type.
    When I tried to insert some dates in our format (dd/mm/yy) the SmartAlbum seemed to not work at all (not selecting any picture, or was coming out with weird results).
    After checking carefully that there was no filter set which could prevent the correct visualization of the pictures I had no explanation for the problem.
    At first I thought that this specific option was buggy as the other Smartalbum creation options (Keywords etc.) seemed to work properly.
    Then I had the idea and I tried to use the english format (mm/dd/yy) for the two dates inside the date range fields and to my surprise everything worked properly.
    So basically it seems that Aperture recognises the dates correctly only giving in input the american date format mm/dd/yy.
    What is not so noice is that there is no check on the date limit correctness so basically it is possible to really mess up with the dates.
    I'm also actually surprised the Aperture doesn't complies with the OS X date type which could seem the logical thing to do or at least is not consistent with the date type management inside the program because for example the pictures Dates are instead correctly listed in the List View of the browser according to the OS X date type (dd/mm/yy).
    I was wondering what is happening in countries where the date separator is not the "/" but the "." like typically used in Germany which would add another variable to the software routine which is interpreting the date input fields.....
    Maybe this could help other non english users who could have been confused like me on the same issue....
    Did you notice the same behaviour ? Am I missing something ?
    Uby

    Smart Albums will search in the Folder/Project that is shown at the top of the search HUD as well as all Folders and Projects "below" in your structure. However, it will not search through any Albums in that structure. Here is an example:
    You images are always stored in Projects (yellow icons) and lets say this is how it looks:
    FolderA/ProjectA (this Project stores: ImageA1, ImageA2)
    FolderA/ProjectB (this Project stores: ImageB1, ImageB2)
    Let us say that you have two Albums like below but there is an image from ProjectB in AlbumA, which looks like this:
    FolderA/ProjectA/AlbumA (this Album has pointers to: ImageA1, ImageA2, ImageB1)
    FolderA/ProjectB/AlbumB (this Album has pointers to: ImageB1, ImageB2)
    If you create a Smart Album below ProjectA it will only show ImageA1 and ImageA2 since it only search ProjectA and not AlbumA.
    This may be the issue you have.
    Are you 100% sure that the Project your Smart Album is pointing at does include the images you are trying to search through. As you see above then it won't find them if they are only in the albums below that project.
    Here are a few rules that I follow in order to avoid getting confused over where my images are located: A) Only include images in albums below a project that are stored in that project. B) Create all my smart albums at top library level and if necessary add extra filters like project name.
    Hope you understand.
    Karsten

  • What are type defs used for?

    I am learning about type defs and wanted to ping the community to get a feel for what expanse of things they are useful for.  Any and all comments are welcome.
    Cheers!
    CLA, CLED, CTD,CPI, LabVIEW Champion
    Platinum Alliance Partner
    Senior Engineer
    Using LV 2013, 2012
    Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.

    I found this (from LV Help) enlightening as to the differences between typedefs and strict typedefs:
    Type Definitions and Strict Type Definitions
    Use type definitions and strict type definitions to link all the instances of a custom control or indicator to a saved custom control or indicator file. You can make changes to all instances of the custom control or indicator by editing only the saved custom control or indicator file, which is valuable if you use the same custom control or indicator in several VIs.
    Type Definitions
    Type definitions identify the correct data type for each instance of a custom control or indicator. When the data type of a type definition changes, all instances of the type definition automatically update. In other words, the data type of the instances of the type definition change in each VI where the type definition is used. However, because type definitions identify only the data type, only the values that are part of the data type update. For example, on numeric controls, the data range is not part of the data type. Therefore, type definitions for numeric controls do not define the data range for the instances of the type definitions. Also, because the item names in ring controls do not define the data type, changes to ring control item names in a type definition do not change the item names in instances of the type definition. However, if you change the item names in the type definition for an enumerated type control, the instances update because the item names are part of the data type. An instance of a type definition can have its own unique label, description, default value, size, color, or style of control or indicator, such as a knob instead of a slide.
    If you change the data type in a type definition, LabVIEW converts the old default value in instances of the type definition to the new data type, if possible. LabVIEW cannot preserve the instance default value if the data type changes to an incompatible type, such as replacing a numeric control or indicator with a string control or indicator. When the data type of a type definition changes to a data type incompatible with the previous type definition, LabVIEW sets the default value of instances to the default value for the new data type. For example, if you change a type definition from a numeric to a string type, LabVIEW replaces any default values associated with the old numeric data type with empty strings.
    Strict Type Definitions
    A strict type definition forces everything about an instance to be identical to the strict type definition, except the label, description, and default value. As with type definitions, the data type of a strict type definition remains the same everywhere you use the strict type definition. Strict type definitions also define other values, such as range checking on numeric controls and the item names in ring controls. The only VI Server properties available for strict type definitions are those that affect the appearance of the control or indicator, such as Visible, Disabled, Key Focus, Blinking, Position, and Bounds.
    You cannot prevent an instance of a strict type definition from automatically updating unless you remove the link between the instance and the strict type definition.
    LabVIEW 8.0.1; WinDoze XP
    aut viam inveniam aut faciam

  • How to convert data type while using @variable function

    Hi Gurus,
    I have a query.
    i have created a Derived Table and the statement is given below.
    select 1 as SENSITIVITY_LEVEL,1 as SUBSENSITIVITY,@variable('US_T') as NITEMS, ...........
    here  in @variable('US_T') "US_T" is hard coded value. I want to change to data type of hard coded value as numeric or integer
    i am using sap BI 4.0 universe design tool.
    Thanks in Advance.
    Regards,
    Jeet

    Hi Jeet,
    Since it is text you can't convert into number.
    Can you please let mw know the exact requriement of yours?
    why you need this
    Thanks,
    Swapnil

  • Creating Custom fields (data type QUAN) using EEWB

    Hi all
    I tried to create two customised fields using EEWB for CRM Opportunity:
    1. Projected Volume (data type 'QUAN', length 13, 3 decimal places)
    2. Projected Unit (data type 'UNIT')
    In the SAP-generated tables, I have set the reference table field for 'Projected Volume' to point to 'Projected Unit'. However, I encountered errors that is related to Table Buffering and Restricted Transport for the Projected Volume field.
    If I were to change the data type to 'NUMC', field generation is ok. Does anyone know to resolve this issue? I need the Projected Volume field to be of data type 'QUAN' since decimal place is required.
    Thanks for your advice!

    SAP Note 746227 has addressed this issue. I will close this question.

  • Data Type to use for Fiscal Year Period selection screen parameter

    I need to accept user input in the format
    YYYY.PP
    where YYYY is the Fiscal year and PP is the Period.
    Is there a data type ( element / domain ) for such a field ?

    date element you can use SPMON
    or
    parameter : p_spmon like MCS0-SPMON.
    regards
    shiba dutta

  • Change what data type data socket requests from OPC server

    I suspect this is a foregone conclusion, however just in case; is there a way to make Datasocket request items from an OPC server in a different data type than variant?
    I have a server that scales integers (native data type) and offers tham as floating point values, however to get those nice floats the client must request the data in the right type. If the client asks for a variant the server will return the integer value (e.g. 2 instead of 2,36...).
    I have not checked whether this is a server behaviour as it must be (according to OPC specs) or if it's just a choice by the vendor (Automated Solutions), but still it may become an obstacle.
    Has anyone implemented OPC Client functionality without using Datasocket (and server for that matter)? Any software componants you can recommend?
    MTO

    Hi Mats
    I once found vi's (..\vi.lib\Platform\dataskt.llb) with different read- and write-types. In fact they are all wrapping up the read- & write-variant functions.
    I use them to communicate with Siemens OPC-Scout and it works. They make life a little easier .
    Hope this helps.
    Thomas
    Using LV8.0
    Don't be afraid to rate a good answer...

  • What MIME type to use for DNG?

    Is there an 'official' MIME type to use for DNG? I've seen image/x-adobe-dng used, also image/tiff, and sometimes image/x-dcraw. I'd like to know so that I can characterize DNGs correctly for format identification software we are writing. I don't believe the MIME type is specified in the DNG spec. Thanks.

    I think this is clear
    image/x-adobe-dng = DNG
    image/tiff = for tiff images. I know that Phase One gives there RAW images .tif at the end but tiff sould be a real image.
    image/x-dcraw = for other camera raw files like CRW/CR2 of Canon, NEF of Nikon....
    I would suggest to use the "image/x-adobe-dng" for DNG files.

Maybe you are looking for

  • How can I set a password for firefox so that everyone have to enter the password before executing firefox

    My younger sister executed my firefox just at this afternoon(she originally use IE), and she saw something that can't be seen. How can I set a password for firefox so that everyone have to enter the password before executing firefox?

  • IDOC mapping issue (calculation using parent and child fields)

    We are mapping an IDOC to a file for output to a third party.  The IDOC has many segments, some of which are embedded.  This is where I'm having the issue.  I am trying to perform a calculation on a field from the parent node (E1EDP01-MENGE) with the

  • Show in finder not working

    Using Spotlight, the "show in finder" option does nothing. Also, under Safari downloads the spyglass icon "show in finder" does nothing. All of the sudden. No installs that I know of, except latest OSX and Mac apps updates. Anyone else seen this? Any

  • Error when playing purchased music

    Hi, When I try to play music purchased from the iTunes Music store, I get an error. I'm first asked to login to my Apple account, which I do without problem, but I then get a -50 error and the music doesn't play. The same music plays fine on another

  • List all subsites from a certain site

    Hi all, I've been trying to get this to work but only partial success. Thing is I created a page in a site. On that page I created a 'Content Search'-WP and it works in the test-area. When I save the query and reload the page, nothing happens. When I