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
14 ответов
0
KrOW, hope you may assit me with this one?
0
Ok, i am here... Anyway, can you explain better what do you want get? what you mean for "variable diagram"?
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?
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;
}
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.
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?
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.
0
that is what I got if I run the program with variables 2 and 3
0
Ruben Oberholzer This is the output of your current code BUT i want know your wanted output for same input...
0
hmm...I am not sure I understand?
0
See this code output please and tell me if you want this
https://code.sololearn.com/c0hbmo7Wro5A/?ref=app
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
0
I think what they basically want from me is to show exactly what the program does when it executes.
0
Try to do it, i cannot do it for you... After your try we see