Hi ,
I was wondering if I can use my visual Studio software to write C++ code instead of OnlineGDB. I tested it during the class yesterday and it seemed to work on the special number project. (Please forgive the lack of comments, I was just testing if it worked or not. I like it because all of my industry work has been in visual studio and it has GitHub build in.
Rick Cramer
Videos
I want to create a Python IDE using Django and JavaScript. I am facing an issue with taking user input when using the exec or eval functions in Python.
After further research, I came across subprocess and IPython, which seem like they could be used to create what I want, but I am still not very confident. Could you please suggest how to create a Python IDE using these tools or any other?
code = "print('Hello, my name is')\nk = input('Enter your name')\nprint(k)"
exec(code)when i run the above code in the vs code by terminal then its
Hello, my name is Enter your name
but when i run in Django then i didn't get
how to achieve same with Django?
code data will come from frontend.
Whoops you have an infinite loop here
//This creates a LCV for the do loop below and sets it equal to 0.
int y = 0;
//This do loop generates the random number.
do
{
//This generates a random time seed.
srand(time(0));
//This generates a random number between 1 and 99.
ran = rand() % 100;
//This while controls the do loop.
}while (y != 9);
y is initialized to 0 and you are looping while y!=9. And that is just the first error, there might be more.
Bug #2
int z = 1;
//This makes the program only create a random number the first pass through the loop.
if (z < 2)
{
//This runs the random number generator function.
return randomgen();
//This sets the result of the function as the random number.
randnum = randomgen();
//This sets the random number to the current number.
num = randnum;
}
After fixing infinite loop in randomgen(), You are immediately returning...
you have two problems in your code: the first one is that you have infinite loop in randomgen() function the condition in check against y - y != 9 but the value never update
int randomgen()
{
//This creates a variable to store the random number.
int ran;
//This creates a LCV for the do loop below and sets it equal to 0.
int y = 0;
//This do loop generates the random number.
do
{
//This generates a random time seed.
srand(time(0));
//This generates a random number between 1 and 99.
ran = rand() % 100;
//This while controls the do loop.
}while (y != 9);
//This returns the random number for use in the rest of the program.
return ran;
}
and the second one is even if you pass the loop in the function you exit main right away because the call to the function randomgen() is with return
if (z < 2)
{
//This runs the random number generator function.
return randomgen(); <-- **second problome**
//This sets the result of the function as the random number.
randnum = randomgen();
//This sets the random number to the current number.
num = randnum;
}
I am doing a group project for school, and I am supposed to read data from an CSV type file. But when i try to read from it in the online GDB i get the following error message:
/usr/bin/ld:g2021_2022_ice.csv: file format not recognized; treating as linker script /usr/bin/ld:g2021_2022_ice.csv:1: syntax error collect2: error: ld returned 1 exit status
As far as i understand, the program is trying to compile the cvs file instead of the C file. Is there a way to fix this?
(The reason i am using an online GDB is because it is easier to work on in a group and share, and also access on different devices).