Welcome to Incels.is - Involuntary Celibate Forum

Welcome! This is a forum for involuntary celibates: people who lack a significant other. Are you lonely and wish you had someone in your life? You're not alone! Join our forum and talk to people just like you.

Serious Programmingcels GTFIH

Lone-Star

Lone-Star

|| KHHV Lolicon Animecel || the King of N.E.E.Ts
★★★★★
Joined
Jan 7, 2020
Posts
6,273
I can't find this shit anywhere, I want to create a c++ program that prints on the screen the first 10 numbers typed by user larger than 100, anyone knows how to do this shit?
I think I need to use for structures or whatever, but i cant figure this out.
 
I can't find this shit anywhere, I want to create a c++ program that prints on the screen the first 10 numbers typed by user larger than 100, anyone knows how to do this shit?
I think I need to use for structures or whatever, but i cant figure this out.
You have to parse the string and identify each number based on pattern etc if the user inputs 1,33,2,66,777,9....

You want to check the string for the commas. Then you can cast the string part into an integer and run an if case.
 
i've only dabbled in c++ for like a week a long time ago, but this shouldn't be that hard to accomplish tbh.
not sure exactly what you want, but in python you could do it like this

numbers_gt_100 = []
while True:
if len(numbers_gt_100) == 10:
break
else:
try:
x = int(input())
if x > 100:
numbers_gt_100.append(x)
except ValueError:
print("Not a number")
continue

print(numbers_gt_100)

while True is an infinite loop and everything inside it is run until it meets a stopping condition, in this case if length of the list numbers_gt_100 == 10.
if it not yet 10 numbers long, then keep trying to get input from the user (else clause). user input string is converted to int and stored in x. if x > 100, then append it to numbers_gt_1000 list, else the loop is repeated. if a user gives letters as input (see except ValueError statement) it also repeats the loop again because of the continue statement

seeing that code format is not preserved on here, here's also a screenshot

1605819735510



hope that gives a bit of a direction. also check stackoverflow
 
Last edited:
it really takes some virgin powers to have the concentration to program
 
i've only dabbled in c++ for like a week a long time ago, but this shouldn't be that hard to accomplish tbh.
not sure exactly what you want, but in python you could do it like this

numbers_gt_100 = []
while True:
if len(numbers_gt_100) == 10:
break
else:
try:
x = int(input())
if x > 100:
numbers_gt_100.append(x)
except ValueError:
print("Not a number")
continue

print(numbers_gt_100)

while True is an infinite loop and everything inside it is run until it meets a stopping condition, in this case if length of the list numbers_gt_100 == 10.
if it not yet 10 numbers long, then keep trying to get input from the user (else clause). user input string is converted to int and stored in x. if x > 100, then append it to numbers_gt_1000 list, else the loop is repeated. if a user gives letters as input (see except ValueError statement) it also repeats the loop again because of the continue statement

seeing that code format is not preserved on here, here's also a screenshot

View attachment 374664


hope that gives a bit of a direction. also check stackoverflow
I adapted your code to c++ and it worked (with small tweaks here and there), thanks alot brocel :feelsYall:
 
No programming for your DNA.
 
#include <iostream>

using namespace std;

int main(){
int loop=0; int input;
while(loop<10){
cin >> input ;
if(input>100) {cout << “Number “ << input << “ is greater than 100.\n”; loop++;}
}
return 0;
}

If you wanna load 1 by 1
i've only dabbled in c++ for like a week a long time ago, but this shouldn't be that hard to accomplish tbh.
not sure exactly what you want, but in python you could do it like this

numbers_gt_100 = []
while True:
if len(numbers_gt_100) == 10:
break
else:
try:
x = int(input())
if x > 100:
numbers_gt_100.append(x)
except ValueError:
print("Not a number")
continue

print(numbers_gt_100)

while True is an infinite loop and everything inside it is run until it meets a stopping condition, in this case if length of the list numbers_gt_100 == 10.
if it not yet 10 numbers long, then keep trying to get input from the user (else clause). user input string is converted to int and stored in x. if x > 100, then append it to numbers_gt_1000 list, else the loop is repeated. if a user gives letters as input (see except ValueError statement) it also repeats the loop again because of the continue statement

seeing that code format is not preserved on here, here's also a screenshot

View attachment 374664


hope that gives a bit of a direction. also check stackoverflow
Python :feelspuke::feelspuke::feelspuke:
 
Last edited:
i've only dabbled in c++ for like a week a long time ago, but this shouldn't be that hard to accomplish tbh.
not sure exactly what you want, but in python you could do it like this

numbers_gt_100 = []
while True:
if len(numbers_gt_100) == 10:
break
else:
try:
x = int(input())
if x > 100:
numbers_gt_100.append(x)
except ValueError:
print("Not a number")
continue

print(numbers_gt_100)

while True is an infinite loop and everything inside it is run until it meets a stopping condition, in this case if length of the list numbers_gt_100 == 10.
if it not yet 10 numbers long, then keep trying to get input from the user (else clause). user input string is converted to int and stored in x. if x > 100, then append it to numbers_gt_1000 list, else the loop is repeated. if a user gives letters as input (see except ValueError statement) it also repeats the loop again because of the continue statement

seeing that code format is not preserved on here, here's also a screenshot

View attachment 374664


hope that gives a bit of a direction. also check stackoverflow
PROGRAMMERS MOG ME FUCK YOUUUUUU

@kodoku
 
#include <iostream>

using namespace std;

int main(){
int loop=0; int input;
while(loop<10){
cin >> input ;
if(input>100) {cout << “Number “ << input << “ is greater than 100.\n”; loop++;}
}
return 0;
}

If you wanna load 1 by 1

Python :feelspuke::feelspuke::feelspuke:

Tbh Python is so fucking disgusting

@Babica Yaga how can you even code without brackets what a fucking disgusting language I tried to learn it for 3 hours but I rage quitted immediately after trying to write an API for that shit fucking most disgusting language ever invented
 
What do you want to do? Just learn basic code or help with a project?
I'm not working on any project atm, I wanna learn what's the logic between doing simple everyday tasks. I was trying to learn web a while ago, I just get stuck with trying to do simple logic in js n shit. There's this website with coding challenges, and I got stuck on the introductionary one jfl
 
Tbh Python is so fucking disgusting

@Babica Yaga how can you even code without brackets what a fucking disgusting language I tried to learn it for 3 hours but I rage quitted immediately after trying to write an API for that shit fucking most disgusting language ever invented

Rsz 4main qimg b4d8dfe1de991041fdaf15df8549de93 c


Tenor 9

Nuff' said

It grows on you. If you ever want to do machine/deep learning you can't really ignore Python because of its superior libraries like Scikitlearn, Tensorflow, Keras and Pytorch.
 
Here's my quick solution. It's not the greatest but it works:
1605833462543
 
Last edited:
just use cin and cout
 

Similar threads

Emba
Replies
5
Views
208
Emba
Emba
Incline
Replies
21
Views
841
FrenchcelNeverbegan
FrenchcelNeverbegan
copemaxx9002
Replies
11
Views
218
SoycuckGodOfReddit
SoycuckGodOfReddit
IncelGolem
Replies
11
Views
345
Friezacel
Friezacel

Users who are viewing this thread

shape1
shape2
shape3
shape4
shape5
shape6
Back
Top