0

Guys, I need to draw a variable diagram for the following code.

Hi Guys! hope someone can assist me? I need to draw a variable diagram for the following program with input values 2 (for variable "first") and 3 (for variable "second") here is the link to the program. https://code.sololearn.com/cG25Rs2p2pUz

20th Sep 2018, 8:43 PM
Ruben Oberholzer
Ruben Oberholzer - avatar
14 Réponses
0
KrOW, hope you may assit me with this one?
20th Sep 2018, 8:44 PM
Ruben Oberholzer
Ruben Oberholzer - avatar
0
Ok, i am here... Anyway, can you explain better what do you want get? what you mean for "variable diagram"?
20th Sep 2018, 8:48 PM
KrOW
KrOW - avatar
0
LOL, I am still a noob, so bear with me. the Question states the following: "Draw variable diagrams for the following program with input values 2 (for variable "first") and 3 (for variable "second"). Figure out how the execution flows in a program like this where the main() calls other functions. For instance : 1. A ? shows an uninitialized value for variable. 2. The notation 25 -> 5 means that excecution jumps from line 25 to line 5. 3. We use square brackets [] around the name of a variable to show that it is inaccessable while the current function is being executed. then there is the code that I linked in the description. Does this make any sence? or am I totally sounding like a retarded noob?
20th Sep 2018, 8:57 PM
Ruben Oberholzer
Ruben Oberholzer - avatar
0
Then you have to trace variable states right? But can you give me your wanted output in this code? #include <iostream> int main(){ int first int second; cin>>first; cin>>second; return 0; }
20th Sep 2018, 9:20 PM
KrOW
KrOW - avatar
0
Ok, so variable states is the same as a variable diagram? :D Sorry, I am learning as we speak. Should you not put in the variables 2 and 3 in the program and then get your output? If that is the case, the output is 6 and 9.
20th Sep 2018, 9:24 PM
Ruben Oberholzer
Ruben Oberholzer - avatar
0
Ruben Oberholzer Dont worry because i dont know this variable diagram (i have not learn coding at school then i lack some concepts)... Anyway do you cannot a example with input and output?
20th Sep 2018, 9:26 PM
KrOW
KrOW - avatar
0
Enter the first number: 2 Enter the second number: 3 The first number is 6now. The second number is 9now. Process returned 0 (0x0) execution time : 4.215 s Press any key to continue.
20th Sep 2018, 9:28 PM
Ruben Oberholzer
Ruben Oberholzer - avatar
0
that is what I got if I run the program with variables 2 and 3
20th Sep 2018, 9:28 PM
Ruben Oberholzer
Ruben Oberholzer - avatar
0
Ruben Oberholzer This is the output of your current code BUT i want know your wanted output for same input...
20th Sep 2018, 9:29 PM
KrOW
KrOW - avatar
0
hmm...I am not sure I understand?
20th Sep 2018, 9:31 PM
Ruben Oberholzer
Ruben Oberholzer - avatar
0
See this code output please and tell me if you want this https://code.sololearn.com/c0hbmo7Wro5A/?ref=app
20th Sep 2018, 10:10 PM
KrOW
KrOW - avatar
0
You mean if I need these results? /* first ? second ? 19->21 first 2 second ? 21->23 first 2 second 3 23->6 [first] [second] */ Yes, That is what I need, but I need all the diagrams/states for the entire code. :D
21st Sep 2018, 5:28 AM
Ruben Oberholzer
Ruben Oberholzer - avatar
0
I think what they basically want from me is to show exactly what the program does when it executes.
21st Sep 2018, 5:29 AM
Ruben Oberholzer
Ruben Oberholzer - avatar
0
Try to do it, i cannot do it for you... After your try we see
21st Sep 2018, 7:46 AM
KrOW
KrOW - avatar