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

C#

 
GeneralRe: SQLTransaction Pin
Hardevsinh Mori16-Sep-17 20:26
professionalHardevsinh Mori16-Sep-17 20:26 
GeneralRe: SQLTransaction Pin
OriginalGriff16-Sep-17 21:44
mveOriginalGriff16-Sep-17 21:44 
GeneralRe: SQLTransaction Pin
Hardevsinh Mori16-Sep-17 21:47
professionalHardevsinh Mori16-Sep-17 21:47 
GeneralRe: SQLTransaction Pin
OriginalGriff16-Sep-17 21:49
mveOriginalGriff16-Sep-17 21:49 
GeneralRe: SQLTransaction Pin
Hardevsinh Mori16-Sep-17 21:51
professionalHardevsinh Mori16-Sep-17 21:51 
GeneralRe: SQLTransaction Pin
OriginalGriff16-Sep-17 21:58
mveOriginalGriff16-Sep-17 21:58 
Questionc# project Pin
Member 1341347616-Sep-17 11:26
Member 1341347616-Sep-17 11:26 
AnswerRe: c# project Pin
Afzaal Ahmad Zeeshan16-Sep-17 11:57
professionalAfzaal Ahmad Zeeshan16-Sep-17 11:57 
Quote:
I thought I assigned it properly.
No, you declared it properly, you did not assign it at all. There is a difference in declaration and assigning, and that concept is similar in C#, C++ and other similar C-family of languages.

The problem persists, because, you cannot expect C# to run like C++, in C#, you need to assign a default value (which differs in structs and class types and I do not want to confuse you on that topic), whereas in C++ you can leave that part and something good (or bad) comes there at that memory address. For the time being, let's just say you want to have a default value of the cookies (which can be, 0, 1, 2,... 10 or whatever), so you do the following,
C#
int cookies = 2; // Or any

// Now the framework allocates a memory for "cookies" and places "2" there. 
Now when you will move onwards you will not get an error on the cookies variable.

But since the multiplication has to work with totalCalories as well, I would leave that upto you to fill and proceed further in the program. Try giving it a value and running the program.

Secondly, I also hope you are not expected to ask for inputs, also you have not shown that attempt so I assume you are allowed to hardcode the amount of these variables.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~

AnswerRe: c# project Pin
Mycroft Holmes16-Sep-17 20:50
professionalMycroft Holmes16-Sep-17 20:50 
QuestionRefresh Partial View Pin
sunsher15-Sep-17 22:57
sunsher15-Sep-17 22:57 
AnswerRe: Refresh Partial View Pin
Richard MacCutchan15-Sep-17 23:45
mveRichard MacCutchan15-Sep-17 23:45 
Questionhow add video support in my application? Pin
Le@rner15-Sep-17 19:19
Le@rner15-Sep-17 19:19 
AnswerRe: how add video support in my application? Pin
Richard MacCutchan15-Sep-17 22:05
mveRichard MacCutchan15-Sep-17 22:05 
AnswerRe: how add video support in my application? Pin
jschell18-Sep-17 12:39
jschell18-Sep-17 12:39 
QuestionC# Dropdown to populate Relationship Tables Pin
Member 1341198315-Sep-17 4:56
Member 1341198315-Sep-17 4:56 
AnswerRe: C# Dropdown to populate Relationship Tables Pin
OriginalGriff15-Sep-17 5:28
mveOriginalGriff15-Sep-17 5:28 
Questionhow to encrypting and decryption pixel of image in C# Pin
WI54M13-Sep-17 23:18
WI54M13-Sep-17 23:18 
AnswerRe: how to encrypting and decryption pixel of image in C# Pin
OriginalGriff13-Sep-17 23:23
mveOriginalGriff13-Sep-17 23:23 
GeneralRe: how to encrypting and decryption pixel of image in C# Pin
WI54M13-Sep-17 23:47
WI54M13-Sep-17 23:47 
GeneralRe: how to encrypting and decryption pixel of image in C# Pin
OriginalGriff14-Sep-17 0:13
mveOriginalGriff14-Sep-17 0:13 
GeneralRe: how to encrypting and decryption pixel of image in C# Pin
WI54M14-Sep-17 0:42
WI54M14-Sep-17 0:42 
GeneralRe: how to encrypting and decryption pixel of image in C# Pin
OriginalGriff14-Sep-17 0:54
mveOriginalGriff14-Sep-17 0:54 
GeneralRe: how to encrypting and decryption pixel of image in C# Pin
WI54M14-Sep-17 1:02
WI54M14-Sep-17 1:02 
GeneralRe: how to encrypting and decryption pixel of image in C# Pin
OriginalGriff14-Sep-17 1:21
mveOriginalGriff14-Sep-17 1:21 
GeneralRe: how to encrypting and decryption pixel of image in C# Pin
WI54M14-Sep-17 1:57
WI54M14-Sep-17 1:57 

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.