Skip to content
Sign UpLog In
Profile icon

Jason Liu

@JasonLiu19
Cats are the best
  • YawningNervousCgibin

    Cover page
    Made with C
    Recent comments (0)
  • ShadowyAptTitle

    Cover page
    Made with C++
    Recent comments (0)
  • RPG

    Cover page
    Made with C++

    Turn-Based RPG

    Recent comments (0)
  • Hangman

    Cover page
    Made with C++
    Recent comments (0)
Repls
Community
JasonLiu19
JasonLiu19
shared a Post
2 years ago
segmentation faults are my worst enemy
I want to make a table, and in each column have a different field for each object of the class Teacher, but I keep getting a segfault. My first idea
GlumGummyPrograms
C++
JasonLiu19
JasonLiu19
shared a Post
2 years ago
Most of the time when I set the type of product to per pound (0), and I put a number in, it causes a segfault. Why, and how to fix it?
BonyMadCoderesource
C++
19wintersp
19wintersp
You will normally get a SegFault if you try to access a pointer whose memory has been deallocated. The most common case when this can happen is if you point to a local variable inside of a function, then return the pointer and use it elsewhere. The memory used inside of the function has been deallocated, leading to a SegFault.2 years ago
Coder100
Coder100
segmentation fault is when you are accessing memory that the OS doesn't want you to access, it's the most non-descriptive error lol2 years ago
JasonLiu19
JasonLiu19
shared a Post
2 years ago
I have something like this: std::string ch; std::ofstream foo("foo"); foo > ch; } std::getline(std::cin, ch) baz.close(); However, baz is not appearin
JasonLiu19
JasonLiu19
shared a Post
2 years ago
So, when I run a range-based loop like this: std::string foo="1"; int baz; for(int bar:foo){ if(bar!='a'){ baz=stoi(std::tostring(baz)+std::tost
IvoryLegalTerabyte
C++
JasonLiu19
JasonLiu19
shared a Post
2 years ago
So basically, I'm making a Ceaser cypher and the shift is at the end of the string. For example: abc with a shift of 1 becomes: bcd\[sh.1 So I reverse
IvoryLegalTerabyte
C++
JasonLiu19
JasonLiu19
shared a Post
2 years ago
Hey, so I'm confused about what OS I should download an external library for. I know repl.it is UNIX based, but I use a Windows 10 operating system,
CodeLongAndPros
CodeLongAndPros
Well you are running the program on UNIX...2 years ago
programmeruser
programmeruser
Download the Linux version, it doesn't matter what computer you use.2 years ago
JasonLiu19
JasonLiu19
shared a Post
2 years ago
When I open a repl, at the top of the console it displays this: clang version 7.0.0-3~ubuntu0.18.04.1 (tags/RELEASE_700/final) But when I run it: clan
Coder100
Coder100
So. clang version 7.0.0-3~ubuntu0.18.04.1 (tags/RELEASE_700/final) is what people like to call 'splash text'. This just tells you the version of the compiler that compiles c++. No need to worry about it, because it doesn't do anything xd clang++-7 -pthread -std=c++17 -o main main.cpp This is the compile command. Seeing the version is no good, you have to actually compile some files! This is where it comes in. Now, pthread just means we want to link a library called pthread, which allows you 2 years ago
Coder100
Coder100
why are you looking at the most unimportant thing ever lol2 years ago
JasonLiu19
JasonLiu19
shared a Post
2 years ago
So I'm trying to make a simple function: void spr(std::string str, int delay){ int i; for(auto v:str){ if(colors[i]==magenta){ std::cout
Coder100
Coder100
no no no! The value of i is not 0! This is undefined behavior, make sure you always define your variable. void spr(std::string str, int delay){ int i = 0; for(auto v:str){ if(colors[i]==magenta){ std::cout << colors[i] << v << std::flush; i=-1; } else{ std::cout << colors[i] << v << std::flush; } std::thisthread::sleepfor(std::chrono::milliseconds(delay)); ++i; } } Also what is i = -1? That's a very easy way to get a segmentation fault, -1 is not2 years ago
JasonLiu19
JasonLiu19
shared a Post
2 years ago
I'm new to HTML, CSS, and JS which should explain the presence of styling. This is pretty straightforward, but everything is explained in-game.
FastVacantSymbols
HTML, CSS, JS
JasonLiu19
JasonLiu19
shared a Post
2 years ago
Just a clicker I made. There is no styling because I have no knowledge of CSS. This is a clicker where you get cheese. Another cow costs 50, and a wo
FastVacantSymbols
HTML, CSS, JS
JasonLiu19
JasonLiu19
shared a Post
2 years ago
I've tried Math.floor and Math.fround, but those don't work. Can anyone help? EDIT: Math.round, Math.ceil, and Math.trunc don't work for me.
FastVacantSymbols
HTML, CSS, JS
RYANTADIPARTHI
RYANTADIPARTHI
try Math.round(). i don't know if you meant round or fround. But another is also Math.ceil(). So try those. Maybe they will work2 years ago
JasonLiu19
JasonLiu19
shared a Post
2 years ago
First, open a new repl. Next declare char op, int num1, and int num2. char op; int num1,num2; In the main function, we ask the user for input for num1
SmoggyMediumCron
C++
Bookie0
Bookie0
Nice, but: > This will actually print 3 error messages, but I don't know how to fix. uhhhh try to fix then.. Als you should really add comments everywhere in your code because comments are great and they help users navigate through the code! ;) but good start!2 years ago
Gr8est
Gr8est
Dude, don't ask for upvotes. It's like asking people for money.2 years ago
JasonLiu19
JasonLiu19
shared a Post
2 years ago
I have something like this: enum confrence{ NFC, AFC } con; enum division{ south, north, east, west } divf; ENUM_MAP(con,"NFC|AFC") ENUM_M
VastCalmMonad
C++
Coder100
Coder100
Well one thing I would like to say is that enum class is way better and probably will suit your needs more: enum class con { NFC, AFC }; `2 years ago
JasonLiu19
JasonLiu19
shared a Post
2 years ago
How do you "peek" forward another character? std::string pronounce(std::string str){ std::string part; bool con=false; for(auto v:str){ for(
SnoopyLostSpreadsheet
C++
Coder100
Coder100
wydm? You could just get the index + 1: int i = 1; std::string whatever = "hello"; whatever[i + 1]; // l `2 years ago
JasonLiu19
JasonLiu19
shared a Post
2 years ago
I was just messing around with loops when I got this. To see the whole thing, just go to pattern.txt.
Pattern
C++
JasonLiu19
JasonLiu19
shared a Post
2 years ago
I wanted to put files in a folder to organize them, but apparently, if a file is in a different folder, you can't include them in a file that is in a
YawningNervousCgibin
C
Coder100
Coder100
Just create the folder again, and also all the files inside the folder. Afterwards, just click that history button and you see you can restore it. Also nice craftinginterpreters!2 years ago
JasonLiu19
JasonLiu19
bruh im just gonna write it again 2 years ago
JasonLiu19
JasonLiu19
shared a Post
2 years ago
I want to learn python but this sum=input("12*2=") if(sum==24): print("Congrats! You win nothing!") else: print("You suck at math!") somehow alway
AlarmedQuizzicalIntranet
Python
Coder100
Coder100
That's because your input is a string You are comparing to a number. Solution: sum=input("12*2=") if sum=='24': print("Congrats! You win nothing!") else: print("You suck at math!") make it a strring!2 years ago
RYANTADIPARTHI
RYANTADIPARTHI
Brakcets: Remove the brackets, and turn the input into an int. and use the code i have given you: sum = int(input("what does 12 * 2 equal ? ")) if sum == 24: print("Congrats, you win") else: print("You suck at math") That should work2 years ago
JasonLiu19
JasonLiu19
shared a Post
2 years ago
When the conditions to make sure that the user can't cheat in void muffin() are met, it should print a message. But the thing is, it doesen't. How to
HiddenNoteworthyOctagon
C++
RYANTADIPARTHI
RYANTADIPARTHI
It looks like everything is working, what's not working?? please tell this, so i can check it2 years ago
Coder100
Coder100
image Maybe line 97? Definitely make sure your class is capitalized, so make it Tech tech;2 years ago
JasonLiu19
JasonLiu19
shared a Post
2 years ago
When I was trying to make a random number generator, I put: #include "random.h" int main(){ std::cout << pickrandint(2315,2482); } (random.h was th
DodgerblueHugeCoins
C++
RYANTADIPARTHI
RYANTADIPARTHI
I don't think there is something called pickrandint, but, try using rand() or srand(). Maybe those will work2 years ago
JasonLiu19
JasonLiu19
shared a Post
2 years ago
You have 5 tries to guess the word. If you get it correct, for some reason it doesn't say so. I got the random word generator from Stackoverflow.
Hangman
C++