artemetra 🇺🇦
Kk In js NaN is a number that not equal to 0, not less than and more than 0.🤷‍♂
there's no NaN in C++, apart from float NaNs i guess..
artemetra 🇺🇦
Kk In js NaN is a number that not equal to 0, not less than and more than 0.🤷‍♂
https://en.cppreference.com/w/cpp/numeric/math/nan oh wait there are
Anonymous
artemetra 🇺🇦
it's a float/double
Ludovic 'Archivist'
To be pedantic it is some form of IEEE754 floating point value
Anonymous
it's a float/double
In js we don't have floating type but if I say isInteger(NaN) it return false🤷‍♂
Ludovic 'Archivist'
I don't actually remember if IEEE754 is mandated to represent floating point values in C++
artemetra 🇺🇦
>console.log(typeof NaN) number i find this funny, "not a number" is a number
Anonymous
Is Nan useful really in c++?
artemetra 🇺🇦
Is Nan useful really in c++?
when converting strings to numbers i guess
Ludovic 'Archivist'
Is Nan useful really in c++?
Well, you fuck up your math but don't pay for math exception interrupts. It is a trade-off
artemetra 🇺🇦
otherwise i have never used it anywhere
Anonymous
Well, you fuck up your math but don't pay for math exception interrupts. It is a trade-off
I told my friends that NaN doesn't make sense, but they said you're not good at math
Ludovic 'Archivist'
I don't actually remember if IEEE754 is mandated to represent floating point values in C++
Okay, so, C++ may use a different approach to floating points values, IEEE754 is not mandated
Ludovic 'Archivist'
There is actually a numeric limits traits to check that
Ludovic 'Archivist'
is_iec559
artemetra 🇺🇦
is_iec559
iec559 == ieee754?
Anonymous
In math we only have Undefined not NaN, yes?
Anonymous
Mr
Just learning 😊
What output you want?
Anonymous
What output you want?
I'm learning js then step to nodejs😊
Anonymous
I love c++ but it hard to me yet
Ludovic 'Archivist'
iec559 == ieee754?
iec559 is the Iso standard for the IEEE754 IEEE standard
Anonymous
Thank u at all😊🙏
Sina
How can I write a program that takes 200 number and return the largest and smallest without array ?
Anonymous
NaN is useful I think, but IEEE doesn't say Nan is a number like JavaScript😊
Anonymous
Ludovic 'Archivist'
Funny
Low effort questions lead to low effort answers
Sina
With a keyboard
Children's joke
Ludovic 'Archivist'
Children's joke
Well, I can do more spicy if you prefer
Anonymous
Why not
Search cppgp in telegram
Anonymous
Why not
https://t.me/CppGp
Anonymous
😈
Sina
https://t.me/CppGp
I joined BTW you now the question I asked?
Sina
Idk cpp
Alright
Ludovic 'Archivist'
I think in c he can use linked list and in c++ he can use vector
You are going too far, you do not need to store the numbers, it can be done in space complexity O(1) and time complexity O(N)
smene
How can I write a program that takes 200 number and return the largest and smallest without array ?
I'd make 3 variables, num, max, min, initialize them to 0, then make a loop of 200 iterations. In each iteration ask to enter a number, then check if num is greater than max and lower than min...
Anonymous
Hello
Anonymous
Can anyone helpme with a code?
Anonymous
#include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); #include "eyes.h" void setup() { // put your setup code here, to run once: pinMode(4,INPUT_PULLUP); pinMode(3,INPUT_PULLUP); pinMode(2,INPUT_PULLUP); Serial.begin(115200); Serial.println("Booting"); if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c)) { // Address 0x3D for 128x64 Serial.println(F("SSD1306 allocation failed")); for(;;); // Don't proceed, loop forever } // Show initial display buffer contents on the screen -- // the library initializes this with an Adafruit splash screen. display.display(); // Clear the buffer display.clearDisplay(); display.display(); } unsigned char readkey(void){ unsigned char ret=0; if (digitalRead(4)==0 ) ret=1; //izquierda if (digitalRead(3)==0) ret+=2; //arriba if (digitalRead(2)==0) ret+=4; //abajo return (ret); } int xp=16; int mood=1; void loop() { int n; static int xd=0; static int espera=0; static int step=0; int x1,x2; if (espera>0) { espera--; delay(1); } else { x1= xd+ (xp>16? (16+2*(xp-16)):xp); x2=64+xd+ (xp<16? (-16+(xp*2)) :xp); switch (step){ case 0: display.clearDisplay(); // Clear the display buffer if (xp<6) { display.drawBitmap(x1, 8, peyes[mood][2][0], 32, 32, WHITE); display.drawBitmap(x2, 8, peyes[mood][1][1], 32, 32, WHITE); } else if (xp<26) { display.drawBitmap(x1, 8, peyes[mood][0][0], 32, 32, WHITE); display.drawBitmap(x2, 8, peyes[mood][0][1], 32, 32, WHITE); } else { display.drawBitmap(x1, 8, peyes[mood][1][0], 32, 32, WHITE); display.drawBitmap(x2, 8, peyes[mood][2][1], 32, 32, WHITE); } display.display(); espera=random(250, 1000); n=random(0,7); if (n==6) { step=1; } else { step=2; } break; case 1: display.clearDisplay(); // Clear the display buffer display.drawBitmap(x1, 8, eye0, 32, 32, WHITE); display.drawBitmap(x2, 8, eye0, 32, 32, WHITE); display.display(); espera=100; step=0; break; case 2: n=random(0,10); if (n<5) xd--; if (n>5) xd++; if (xd<-4) xd=-3; if (xd>4) xd=3; espera=0; step=0; break; } } //n=0; n=readkey(); if (n==2) xp=(xp<=0?0:xp-1); if (n==4) xp=(xp>=32?32:xp+1); if (n==1) { mood=(mood>=5?0:mood+1); do {} while (readkey()!=0); } if (n!=0) { espera=0; step=0; } }
Anonymous
I need to simplificate it and quit the confusing parts
Shadow
Can anybody help me to write this program.. Write a C program to read programming languages and their demand in IT industries and display top 3 programming languages used in IT industry.
Mr
#include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 64 // OLED display height, in pixels // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins) #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); #include "eyes.h" void setup() { // put your setup code here, to run once: pinMode(4,INPUT_PULLUP); pinMode(3,INPUT_PULLUP); pinMode(2,INPUT_PULLUP); Serial.begin(115200); Serial.println("Booting"); if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c)) { // Address 0x3D for 128x64 Serial.println(F("SSD1306 allocation failed")); for(;;); // Don't proceed, loop forever } // Show initial display buffer contents on the screen -- // the library initializes this with an Adafruit splash screen. display.display(); // Clear the buffer display.clearDisplay(); display.display(); } unsigned char readkey(void){ unsigned char ret=0; if (digitalRead(4)==0 ) ret=1; //izquierda if (digitalRead(3)==0) ret+=2; //arriba if (digitalRead(2)==0) ret+=4; //abajo return (ret); } int xp=16; int mood=1; void loop() { int n; static int xd=0; static int espera=0; static int step=0; int x1,x2; if (espera>0) { espera--; delay(1); } else { x1= xd+ (xp>16? (16+2*(xp-16)):xp); x2=64+xd+ (xp<16? (-16+(xp*2)) :xp); switch (step){ case 0: display.clearDisplay(); // Clear the display buffer if (xp<6) { display.drawBitmap(x1, 8, peyes[mood][2][0], 32, 32, WHITE); display.drawBitmap(x2, 8, peyes[mood][1][1], 32, 32, WHITE); } else if (xp<26) { display.drawBitmap(x1, 8, peyes[mood][0][0], 32, 32, WHITE); display.drawBitmap(x2, 8, peyes[mood][0][1], 32, 32, WHITE); } else { display.drawBitmap(x1, 8, peyes[mood][1][0], 32, 32, WHITE); display.drawBitmap(x2, 8, peyes[mood][2][1], 32, 32, WHITE); } display.display(); espera=random(250, 1000); n=random(0,7); if (n==6) { step=1; } else { step=2; } break; case 1: display.clearDisplay(); // Clear the display buffer display.drawBitmap(x1, 8, eye0, 32, 32, WHITE); display.drawBitmap(x2, 8, eye0, 32, 32, WHITE); display.display(); espera=100; step=0; break; case 2: n=random(0,10); if (n<5) xd--; if (n>5) xd++; if (xd<-4) xd=-3; if (xd>4) xd=3; espera=0; step=0; break; } } //n=0; n=readkey(); if (n==2) xp=(xp<=0?0:xp-1); if (n==4) xp=(xp>=32?32:xp+1); if (n==1) { mood=(mood>=5?0:mood+1); do {} while (readkey()!=0); } if (n!=0) { espera=0; step=0; } }
Use pastebin.com please
Руслан
How to find an element of an array equal to a value using C's built-in search methods?
Руслан
I have array {11, 14, 2022} and find 2022
Anonymous
#include <stdio.h> #include <conio.h> int abhi() { int a[10000],i,n,key; printf("Enter size of the array : "); scanf("%d", &n); printf("Enter elements in array : "); for(i=0; i<n; i++) { scanf("%d",&a[i]); } printf("Enter the key : "); scanf("%d", &key); for(i=0; i<n; i++) { if(a[i]==key) { printf("element found "); return 0; } } printf("element not found"); }
@MACHARIA
Help me to write a payroll in the C program that includes NHIF, NSSF, and Tax. I have surrendered.
#
Hello anyone here
#
I have problem with code
Владимир
how to include openmp? i istalled lib into /opt/homebrew/opt/libomp and set this dir to compiler settings. but anyway linker throw error: clang: error: linker command failed with exit code 1 what I'm doing wrong? c_cpp_properties.json: "includePath": [ "${workspaceFolder}/**", "/opt/homebrew/opt/libomp/include/**", "/opt/homebrew/opt/libomp/lib/**" ], "defines": [], "macFrameworkPath": [ "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks" ], "compilerPath": "/usr/bin/clang", "cStandard": "c17", "intelliSenseMode": "macos-clang-arm64", "browse": { "path": [ "/opt/homebrew/opt/libomp/include", "/opt/homebrew/opt/libomp/lib" ] } main.cpp: #include </opt/homebrew/opt/libomp/include/omp.h>
DaviChan
Sorry, what build system is that?
DaviChan
Looks strange to me to be honest. Also the < > dont make sense if you specify tman absolute and entire path anyways?
DaviChan
Doesnt look very portable also
DaviChan
Oh, this is the clang error? I though that was a build file. Have you tried using cmake? I don't think including a single header will do
Fetheddine
code blocks
Fetheddine
vs code
soheil
vim - vs code
Aakash
Cannot use Turbo C?
Aakash
Turbo c software
SHP
I personally prefer vscode, it's availa ble on both ubuntu and win, light and easy to cowork with other languages
Aakash
Okay but turbo is okay or not?
SHP
I'll give it an okay, but it's just usable for me
Aakash
You have worked on Turbo?
Pavel
Okay but turbo is okay or not?
Turbo is outdated, it was even prohibited to discuss by the previous rules of this group :)