Click here to Skip to main content
15,887,683 members
Home / Discussions / C#
   

C#

 
AnswerRe: Wrong select query SQLite? Pin
Garth J Lancaster20-Apr-15 20:40
professionalGarth J Lancaster20-Apr-15 20:40 
GeneralRe: Wrong select query SQLite? Pin
DPaul199420-Apr-15 20:43
DPaul199420-Apr-15 20:43 
GeneralRe: Wrong select query SQLite? Pin
Garth J Lancaster20-Apr-15 21:07
professionalGarth J Lancaster20-Apr-15 21:07 
GeneralRe: Wrong select query SQLite? Pin
DPaul199421-Apr-15 0:26
DPaul199421-Apr-15 0:26 
GeneralRe: Wrong select query SQLite? Pin
DPaul199420-Apr-15 20:44
DPaul199420-Apr-15 20:44 
GeneralRe: Wrong select query SQLite? Pin
Garth J Lancaster20-Apr-15 21:08
professionalGarth J Lancaster20-Apr-15 21:08 
GeneralRe: Wrong select query SQLite? Pin
DPaul199421-Apr-15 0:26
DPaul199421-Apr-15 0:26 
GeneralRe: Wrong select query SQLite? Pin
Richard Deeming21-Apr-15 2:30
mveRichard Deeming21-Apr-15 2:30 
It's the same problem as your other code - integer division.

  1. 15 / 8 = 1.875, but since the variables are integers, only the integer part is used: 15 / 8 = 1
  2. You then multiply that result by 100, which (unsurprisingly) gives a final result of 100.
  3. You then store that final result in a double, but it's too late - you've already lost the fractional part at step 1.


You need to convert one of the values to a floating-point type before the division:
C#
medie_sim = ((double)totalsim / totalsimyes) * 100;
// or:
// medie_sim = (totalsim / (double)totalsimyes) * 100;




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


QuestionHi! Pin
Member King Fisher20-Apr-15 17:51
Member King Fisher20-Apr-15 17:51 
SuggestionRe: Hi! Pin
Richard MacCutchan20-Apr-15 21:28
mveRichard MacCutchan20-Apr-15 21:28 
QuestionEmpty path name is not legal Pin
DPaul199420-Apr-15 10:12
DPaul199420-Apr-15 10:12 
AnswerRe: Empty path name is not legal Pin
Sascha Lefèvre20-Apr-15 10:18
professionalSascha Lefèvre20-Apr-15 10:18 
GeneralRe: Empty path name is not legal Pin
DPaul199420-Apr-15 10:27
DPaul199420-Apr-15 10:27 
GeneralRe: Empty path name is not legal Pin
Sascha Lefèvre20-Apr-15 10:35
professionalSascha Lefèvre20-Apr-15 10:35 
GeneralRe: Empty path name is not legal Pin
DPaul199420-Apr-15 10:50
DPaul199420-Apr-15 10:50 
GeneralRe: Empty path name is not legal Pin
Sascha Lefèvre20-Apr-15 10:59
professionalSascha Lefèvre20-Apr-15 10:59 
GeneralRe: Empty path name is not legal Pin
dhivya.sakthi21-Apr-15 23:50
dhivya.sakthi21-Apr-15 23:50 
AnswerRe: Empty path name is not legal Pin
Pete O'Hanlon20-Apr-15 10:21
mvePete O'Hanlon20-Apr-15 10:21 
GeneralRe: Empty path name is not legal Pin
DPaul199420-Apr-15 10:27
DPaul199420-Apr-15 10:27 
GeneralRe: Empty path name is not legal Pin
Pete O'Hanlon20-Apr-15 10:46
mvePete O'Hanlon20-Apr-15 10:46 
GeneralRe: Empty path name is not legal Pin
DPaul199420-Apr-15 10:50
DPaul199420-Apr-15 10:50 
QuestionAny rules how to name C# source files? Pin
CRobert45620-Apr-15 5:50
CRobert45620-Apr-15 5:50 
AnswerRe: Any rules how to name C# source files? Pin
Sascha Lefèvre20-Apr-15 5:59
professionalSascha Lefèvre20-Apr-15 5:59 
AnswerRe: Any rules how to name C# source files? Pin
Pete O'Hanlon20-Apr-15 7:01
mvePete O'Hanlon20-Apr-15 7:01 
AnswerRe: Any rules how to name C# source files? Pin
Eddy Vluggen20-Apr-15 8:11
professionalEddy Vluggen20-Apr-15 8:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.