Abhishek
Has anyone worked with Assimp? I've downloaded the library source Should I be using that entire thing or just the code folder? I am trying to use it with add_subdirectory() in CMake in my project I am using MinGW to compile I am using C++ 17
Aura
/warns
Jitendra
/warns
Yasas
/warns
Yasas
/note
Yasas
/get
Yasas
/get notes
Yasas
/get cpp-vscode
Ekal
hello
Ekal
ive got a question
Ekal
im on a mini project
Ekal
it is said to make a program
Ekal
Example project: The mini project can calculate: 1. Area of square 2. Area of triangle 3. Volume of cone 4. Average of 5 numbers 5. Body Mass Index (BMI)
Ekal
my question is how to merge or combine two calculation??
Garima
my question is how to merge or combine two calculation??
You can use switch statements, this will give user a choice that which calculation they want
Ekal
thankyou i will try that
Aditi s
/warns
Official hooligan of Pius XII
I have some weird problem I declare CLEAR this way #ifdef _WIN32 const char CLEAR[3] = {'c', 'l', 's'}; #else const char CLEAR[5] = {'c', 'l', 'e', 'a', 'r'}; #endif but when i pass it to a function doing system(CLEAR) it is interpreted as "clsE0'a" on windows (on linux "clear" works) can anyone point me what might be the case?
Anonymous
what the difference between gcc and g++
Official hooligan of Pius XII
You need to add a zero at the end of your buffer, otherwise your function will read out of bounds of it
1) '0' or '\0'? 2) do i need to increase sizes of the arrays to 4 and 6 after adding it?
Pavel
Pavel
what the difference between gcc and g++
https://www.geeksforgeeks.org/difference-between-gcc-and-g/amp/
Official hooligan of Pius XII
Official hooligan of Pius XII
tho on linux it was working all the time, are unixlike os-es more smart when it comes to c-strings?
Pavel
tho on linux it was working all the time, are unixlike os-es more smart when it comes to c-strings?
In general, reading out of bounds is UB, so sometimes it can result in working as intended. What happened probably, is on Linux there was zero byte in the memory right after your buffer (likely from some other variable/constant)
𝙰𝚖𝚖𝚊𝚛
Hello everyone Is there a "type casting" for functions in C++ ? I mean if i have an "int function(int , char )" and in a special case i want to make this function return string, can i make that? Or is there another way to do this? Sorry for my long message but this group helps me a lot
ninja
/warns
𝙰𝚖𝚖𝚊𝚛
Are conditions for this special case being checked at runtime?
I guess yes It is a function which is calculator.. and division by zero is not possible, so i want to cout a message that says "cannot be calculated".. but it could be a zero like 1 - 1 @skelly37
Official hooligan of Pius XII
well, you can also always return a string and then use stoi() if possible, if you want it to be really straightforward, like that string test() {return "1";} int main() {int test1 = stoi(test());}
Pavel
I guess yes It is a function which is calculator.. and division by zero is not possible, so i want to cout a message that says "cannot be calculated".. but it could be a zero like 1 - 1 @skelly37
Well, you can return std::variant<int, std::string> as a possible way, but that will be rather ugly I think. You can return the value using by-reference argument and return an error code (bool or int) from the function to indicate an error. Also ugly. Or return std::pair<int, bool> or std::pair<int, std::string> (first one is how it's usually done in STL) (ugly? I guess so) You can throw an exception with the error and catch it outside, that also will be ugly, but probably a bit better, probably.
𝙰𝚖𝚖𝚊𝚛
𝚒𝚗𝚝 𝙾𝚙(𝚒𝚗𝚝 &𝚡, 𝚌𝚑𝚊𝚛 𝚘){ 𝚒𝚗𝚝 𝚡2; 𝚌𝚒𝚗 » 𝚡2; 𝚜𝚠𝚒𝚝𝚌𝚑(𝚘) 𝚌𝚊𝚜𝚎 ' - ': 𝚡 = 𝚡 - 𝚡2; 𝚛𝚎𝚝𝚞𝚛𝚗 𝚡; 𝚌𝚊𝚜𝚎 '/': 𝚡 = 𝚡 / 𝚡2; 𝚛𝚎𝚝𝚞𝚛𝚗 𝚡; } 𝚒𝚗𝚝 𝚖𝚊𝚒𝚗 () { 𝚌𝚒𝚗 » 𝚡 » 𝚘; 𝚌𝚘𝚞𝚝 « 𝙾𝚙(𝚡,𝚘); 𝚛𝚎𝚝𝚞𝚛𝚗 0; } I want to cout a message if x2=0, but also 1 - 1 could be zero too @skelly37 @gameraccoon
Official hooligan of Pius XII
im a bit sleepy and on phone so its rather pseudocode but i bet you understand the idea
𝙰𝚖𝚖𝚊𝚛
i'd return a pointer to an array looking like { bool if it could be calculated, int result or 0} if(array[0)) cout array[1]
I cannot handle with pointers at the moment.. i didn't study it yet.. so another idea ? 😅😢
Official hooligan of Pius XII
stoi() literally converts string to integer
𝙰𝚖𝚖𝚊𝚛
@skelly37 @gameraccoon I will think about it and give it a try... Thanks a lot for help
$lick $loth
Podrían ayudarme?
Rberto
Podrían ayudarme?
only english pls
$lick $loth
Can someone help me with ac programming test?
Jostick
Hi, some one can help me, I want to learn c++ but I dont know the steps to follow to be a profesional, beacuse i would like to contribute to linux or other programs written in c++
olli
Hi, some one can help me, I want to learn c++ but I dont know the steps to follow to be a profesional, beacuse i would like to contribute to linux or other programs written in c++
Get a good book and start programming! Codesignal has a variety of challenges for every difficulty level. Once you're stuck, we're here to help. Btw Linux is written in C, not C++. Linus Torvalds has pretty strong opinions about this.
class Person(Skills): name = str("Ankush Bhagat")
How I do that : If (os == Android) { ..... } In C language !
Official hooligan of Pius XII
Official hooligan of Pius XII
you can also use #else in here
Official hooligan of Pius XII
Here are another cases. Compiler macros are very useful sometimes https://iq.opengenus.org/detect-operating-system-in-c/
class Person(Skills): name = str("Ankush Bhagat")
#ifdef __ANDROID__ [your code] #endif
Thank you got it bro 🥰🥰
class Person(Skills): name = str("Ankush Bhagat")
Brother can you help me how did I print ASCII art or ANSI art with printf or puts in C 🔥
class Person(Skills): name = str("Ankush Bhagat")
I searched over internet but I didn't find any solution !
Official hooligan of Pius XII
I searched over internet but I didn't find any solution !
Have you tried this? https://stackoverflow.com/questions/1472581/printing-chars-and-their-ascii-code-in-c
class Person(Skills): name = str("Ankush Bhagat")
Like this ╲ ▁▂▂▂▁ ╱ ▄███████▄ ▄██ ███ ██▄ ▄███████████▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄ █▄ ██ █████████████ ██ ██ █████████████ ██ ██ █████████████ ██ ██ █████████████ ██ █████████████ ███████████ ██ ██ ██ ██
Official hooligan of Pius XII
shit, i'm still sleeping lmao sorry so i don't know the anwser, i mostly use c++ and don't know much about printf
Rberto
no, only english, that's a rule...
olli
Like this ╲ ▁▂▂▂▁ ╱ ▄███████▄ ▄██ ███ ██▄ ▄███████████▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄ █▄ ██ █████████████ ██ ██ █████████████ ██ ██ █████████████ ██ ██ █████████████ ██ █████████████ ███████████ ██ ██ ██ ██
e.g. #include <stdio.h> int main() { const char * Art[] = { " ╲ ▁▂▂▂▁ ╱", " ▄███████▄", " ▄██ ███ ██▄", " ▄███████████▄", " ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄ █▄", " ██ █████████████ ██", " ██ █████████████ ██", " ██ █████████████ ██", " ██ █████████████ ██", " █████████████", " ███████████", " ██ ██", " ██ ██" }; for (int i = 0; i < sizeof(Art) / sizeof(Art[0]); ++i) { puts(Art[i]); } } https://godbolt.org/z/b9echKhxK
class Person(Skills): name = str("Ankush Bhagat")
#include <stdlib.h> int main() { int system(const char *command); system("var=$OSTYPE"); system("printf $var"); return 0; }
class Person(Skills): name = str("Ankush Bhagat")
Why $var is not printing ???
class Person(Skills): name = str("Ankush Bhagat")
Guys help me
Ammar
#include <stdlib.h> int main() { int system(const char *command); system("var=$OSTYPE"); system("printf $var"); return 0; }
That would be different shell. Each call to system() spawns: /bin/sh -c cmd So you lost the var in the second call.
class Person(Skills): name = str("Ankush Bhagat")
Give me a example of
Jostick
So do you recommend learn c firts AND c++ after?
Jostick
Oh ok
Jostick
Thank you
Manav
//Input format 23,34,5423,12 /*Output format: 23 34 5423 12 */ #include <iostream> using namespace std; int main() { string str; cout << "Enter a string" << endl; cin >> str; char dstr[20][20]; int k = 0, i = 0, j = 0; while (str[k] != '\0'){ if (str[j] == ',') { i++; } else { dstr[i][j] = str[k]; j++; } k++; } for(int l=0 ; l<i ; l++) { for(int m=0 ; m<j ; m++){ cout<<dstr[i][j];} cout<<endl; } return 0; }
RC
Hey, anyone use Clion? I wrongly made it to zen mode but I wanna change it to be like past, can u help?
@
I do
RC
How should I Change it? I'll be grateful if you can help
@
When you scroll around the upper edge of the screen does the menu pops?
@
Then press on "view">appearance>exit zen mode