Wisenky
its not mistake logically I want it
Mar!o
huh?! you know your if means: if(table.getTurn()%==! || true) ?
Mar!o
it will get optimized away
Asdew
No, he wants to check if table.getTurn() % 4 is either 1 or 3.
Wisenky
yeah
Wisenky
sometimes I got C++ error : terminate called after throwing an instance of 'std::bad_alloc' this error but Idk what to do
Mar!o
Then you have to do: if(table.getTurn() % 4 == 1 || table.getTurn() % 4 == 3)
Mar!o
or better: const auto x = table.getTurn() % 4; if(x == 1 || x == 3)
Dima
it does
Mar!o
but how you wrote it its wrong
Mar!o
I will not evalute 3
Wisenky
!
https://hastebin.com/uvetejobeb.cpp this is working great but I couldnt create unsignable squares in it then so I rewrite my code
Asdew
The compiler reads the incorrect if statement as: if((table.getTurn % 4 == 1) == true || 3 == true)
Mar!o
Then you have to do: if(table.getTurn() % 4 == 1 || table.getTurn() % 4 == 3)
or this if the getTurn() is heavy better do the first way
Wisenky
Dima
a logical error
Wisenky
okay I fixed it still doesnt work
Wisenky
😩
Mar!o
Wisenky
what does not work?
you input a square and the program crushes before your input signed
Wisenky
you input a square? a squared number?!
a number which is in a square
Mar!o
ahh ok any error messages?
Mar!o
Mar!o
why no switch here?
Wisenky
hand habit
Wisenky
guys I switch to vscode and it executes well
Wisenky
why dev-c doesnt works great Idk
Mar!o
vscode is no compiler.. what compiler did you use?
Wisenky
yeah
Wisenky
vscode is no compiler.. what compiler did you use?
there was a compiler extension Im using it
Wisenky
vscode is no compiler.. what compiler did you use?
https://marketplace.visualstudio.com/items?itemName=danielpinto8zz6.c-cpp-compile-run
Wisenky
vscode is no compiler.. what compiler did you use?
but when I run it in external console it doesnt works again
Wisenky
Its sooo werid
Asdew
Unrelated to your issue: don't use the command cls directly, use a cross-platform way to clear the screen.
Asdew
And definitely do not use pause.
Asdew
use carriage return \r for each line
I don't know this one, could you elaborate?
Mar!o
it set's the terminal cursor back to the beginning of the line
Anonymous
Hello
Anonymous
why dev-c doesnt works great Idk
Because it's shitty
Mar!o
Wisenky
Because it's shitty
no its not shitty problem was on my program's logics
Wisenky
still shitty
maybe your fault
Sinan
maybe your fault
i dont think so
Wisenky
i dont think so
okay keep think like that
Ибраги́м
https://www.youtube.com/watch?v=q6A7cKFXjY0
Ибраги́м
VEry interesting
Wisenky
it set's the terminal cursor back to the beginning of the line
https://hastebin.com/ejuqatagod.cpp It's completely working now I fixed it
lotuslwt
hi, I have a big problem about vim ale plugin, anyone teach me?
lotuslwt
lotuslwt
sorry, this problem is about vim clang_complete, but also related about vim ale plugin.
lotuslwt
ale: 'stdio.h' file not found [clang-diagnostic-error]
frakw
since i have memory allocate in class so i have to overload assignment operator but But besides assign one by one, is there any better way?
Ankit
👋 hello
Ankit
Thank you joining me in this community
Anonymous
Anonymous
/warn
Anonymous
#include <iostream> #include <string> using std :: cout; using std :: cin; using std :: endl; int main () { int X [10]; for (int i = 0; i <10; i ++) { cout << "[" << i + 1 << "]" << ":"; cin >> X [i]; } int Y [10]; for (int i = 0; i <10; i ++) { cout << "[" << i + 1 << "]" << ":"; cin >> Y [i]; } int Z [10]; for (int i = 0; i <10; i ++) { cout << "[" << i + 1 << "]" << ":"; cin >> Z [i]; } cout << "\ nYour array:"; //Function for (int i = 0; i <10; ++ i) { cout << arr [i] << ""; } cout << endl; return 0; } // F-tion int SumPositive (const int * arr, int size) { int result = 0; for (int i = 0; i <size; ++ i) if (arr [i]> 0) result + = arr [i]; return result; } how can I output all arrays with a single output in the code?
Immortal
hi pals pls i am done with the basic of c++ wat else should i learn to create desktop and mobile applications
Anonymous
Wtf why you need a find index when there is strcspn?
Anonymous
Why you need replace word when you make replace char?
Anonymous
Ok
Eugy
excuse me i have a question a C program CODE that will give the final value of X when it is elevated by 15% the de-elevated by 20%.
Anonymous
Question want that
Well we are not here to solve your school homework
Rand
Abhishek
Hey everyone, my code is not taking string input or output Can some one help. This is my code ::: #include<iostream> #include <cstring> using namespace std ; void concatenatestring() { string str1 , str2 ,str3; cout<<"Enter the String 1 :"<<endl; getline(cin , str1); cin.clear(); cout<<"Enter the String 2 :"<<endl; getline(cin , str2); cin.clear(); str3 = str1 + str2 ; cout <<str3; } void wordcount() { string str; cout <<"Enter the String : "<<endl; getline(cin , str); cin.clear(); int m; m= str.length(); cout <<"The number of words is :"<< m<<endl; } void b_string() { string str; cout <<"Enter the String : "<<endl; getline(cin , str); cin.clear(); int m; m= str.length(); for(int i = m-1 ; i >=0 ; i-- ) { cout<<str[i]; } cout <<endl; } void frequent() { string str; getline(cin , str); int count[26]; int m ; m= str.length(); for (int i=0; i< 26 ; i++) { count[i]=0; } for(int i=0 ; i < m ; i++) { count[(int(str[i])-97)]++; } int l; int ANS=0; for(int y=0 ; y< 26 ; y++) { cout<<count[y]; } for (l=0; l < 26 ; l++) { if(count[ANS]<count[l]) { ANS=l; } } cout<<"The Most Frequent Character in the String is : "<<char(ANS+97); } void palin() { string str_p ; cout <<"Enter the String : "<<endl; getline(cin , str_p); cin.clear(); int m; m= str_p.length(); for(int i = 0 ; i <m ; i++ ) { if(str_p[i]!=str_p[m-1-i]) { cout<<"String is palindrome"<<endl; } else { cout<<"String is not palindrome"<<endl; } } } int main() { int ques; cout<<"1) To find the most frequent character in a string\n"<<"2) To display a given string from backward\n"<< "3) to count number of words in string\n"<< "4) To concatenate one string contents to another\n"<< "5) To check a string is palindrome or not\n"<< "6) To find a substring within a string"<< "Enter the question number : "<<endl; cin>>ques; switch(ques) { case 1: { frequent(); break; } case 2: { b_string(); break; } case 3: { wordcount(); break; } case 4: { concatenatestring(); break; } case 5: { palin(); break; } case 6: { break; } default: { cout<<"wuw"; } } return 0; }
Abhishek
Please suggest me a way so that it can work