Mihail
I read that you asked if you have to use Android studio for it
Mihail
So yes you can use it with android studio
Mihail
But you don't have to
Anonymous
So yes you can use it with android studio
so, can you xplain atleast this process thing?
Mihail
I haven't worked with it much, so I'd rather not
Mihail
I don't do android development
Anonymous
🐰🐾 سمیه
Segmentation fault (core dumped) whats this error?
🐰🐾 سمیه
in c
BinaryByter
you are reading memory you shouldn't read
BinaryByter
or writing to
🐰🐾 سمیه
so what should I do
BinaryByter
you are probably reading at a position in the array that is too big for the array
BinaryByter
check for that
Rahul
so what should I do
Get the core dump file by core -c ulimit
Rahul
Run gdb . Exe core
Rahul
Find the error
Ибраги́м
Wow
Rust people claim we've awful error messages, that
Ибраги́м
is getting undone in every release
🐰🐾 سمیه
Ok, thanks guys. I'll use gdb
Ибраги́м
Ok, thanks guys. I'll use gdb
Can u http://pastebin.com/ your code and let us throw u some rotten tomatoes first
🐰🐾 سمیه
sure, thanks.
🐰🐾 سمیه
https://hastebin.com/epocumogow.cpp
🐰🐾 سمیه
https://hastebin.com/epocumogow.cpp
https://t.me/programminginc/144585
Ибраги́м
Alrighty then
🐰🐾 سمیه
It wants to get a list of numbers, and then another number to check if there is a match for it among the numbers in the list.
Anonymous
that should be "else if" instead of "if", i think
Anonymous
at 2nd if
🐰🐾 سمیه
Ok thanks, I'll correct it.
🐰🐾 سمیه
at 2nd if
Why not if.
Anonymous
why are you using else if at 4th if point?
Anonymous
you should use curly bracket in each of if and else commands
🐰🐾 سمیه
The function part was in the book. It checks whether X is in the upper half or the lower half.
olli
try doing cout « setprecision (10) « 10.5;
10.5 can however actually be stored
BinaryByter
I realized that
Ибраги́м
https://hastebin.com/epocumogow.cpp
This is a good example of "How to self-destruct"
🐰🐾 سمیه
Run gdb . Exe core
I ran "core" command on gdb and got this message: No core file now.
Anonymous
sorry i am alien😂
Ибраги́м
Starting with while ( getchar() != EOF ) v[i++] = getchar(); 1. getchar() not your friend here, u need to issue it a divorce. what you want here is scanf() Replace with: for (i = 0; i < 5; ++i) { scanf("%d", &v[i]); } PS: my C is ever rusty
Ибраги́м
int main() { int i; extern int v[], x; /// What is the value of x? printf ("enter a list of numbers:\n"); for (i = 0; i < 5; ++i) { scanf("%d", &v[i]); } /// get the number you want to search scanf("%d", &x); /// look for proper binary search here: https://rosettacode.org/wiki/Binary_search#C printf ("%d", binsearch()); }
Ибраги́м
Look @ Proper Binary search here https://rosettacode.org/wiki/Binary_search
Ибраги́м
2. Depending on extern, C is every yucky!
🐰🐾 سمیه
thanks🌷🌷🌷
Ибраги́м
X is the number we want to search. First, we should enter a list of numbers, and second, we should enter X to see if there is a match. The book haven't talked about scanf( ) yet, so I wanted to do with getchar ( ).
1. That's why u need to take a look @ Binary Search here: https://rosettacode.org/wiki/Binary_search and try completing it on your own (u might get help in the group if u happen to be stuck) 2. Let me show you why getchar() is evil in this context: int main() { printf("Enter Value: "); int i = getchar(); printf("\nPrinting Character equivalent: %c\n" "Printing Integer equivalent: %d\n" ,i, i); }
Anonymous
Std::cin.get() I believe the enter key is counted as well right ?
🐰🐾 سمیه
2. Let me show you why getchar() is evil in this context: #include <stdio.h> int main() { int i = getchar(); printf("Printing Character equivalent: %c\n" "Printing Integer equivalent: %d\n" ,i, i); }
🐰🐾 سمیه
This part
Anonymous
Hello
Anonymous
I have an issue I need help with
Anonymous
I am using cin.get to take in a character input
🐰🐾 سمیه
Ok, I'll do it now
Ибраги́м
Ибраги́м
I have an issue I need help with
So, what's the issue ?
🐰🐾 سمیه
It prints a character and its ASCII integer value using getchar. So what's the problem with it?
Dima
lol
Dima
Ибраги́м
سمیه I'm waiting
🐰🐾 سمیه
🐰🐾 سمیه
Ибраги́м
For what
Slap yourself and post it on https://gfycat.com
Ибраги́м
For what
Because the problem is glaring I'm confused u didn't see it
Ибраги́м
See ?
Ибраги́м
See ?
Even if u have the best algorithm your input will be wrong most times
🐰🐾 سمیه
I've used getchar and the book has also used it many times, what's wrong with it? 🤷‍♀
Anonymous
So, what's the issue ?
I have a problem that is a guessing game
Anonymous
The user has 10 try’s to guess a word
Anonymous
The user inputs one letter at a time
Anonymous
This letter variable is a char
Anonymous
When I used std::cin, it ignores spaces , which some of the names they are guessing has two words , so they Are strings and a space input would be needed
Ибраги́м
See ?
سمیه Can't u see I entered 20, it stored 50