Anonymous
Ok. Then tell me a book that you can understand very well
C++ Primer by Stanley Lippman for basic C++. Modern Effective C++ by Scott Meyers' C++ Templates by Vandervoode and Josuttis C++ Concurrency in Action by Anthony Williams
shriman_deepak
What is RTree?
Rose Tree i think
'''''''
Rose Tree i think
Lmao, no "R-tree - Wikipedia" https://en.m.wikipedia.org/wiki/R-tree
shriman_deepak
Lmao, no "R-tree - Wikipedia" https://en.m.wikipedia.org/wiki/R-tree
Oh I said because there's rose tree in functional programming
Christian
int c, nl; nl=0; while((c = getchar()) != EOF) if (c =='\n'); ++nl; printf("%d\n", nl); if I write something and press enter, then ctrl+z it always returns 1, even if I put more newlines. why?
Anonymous
I need someone to seriously help me with a difficult assignment to private chat me
Anonymous
on C++ programming
Achille
Ok thanks
Indigo_demi_god
Create function you've not gave any variable to recieve
Anonymous
How to split strings when inputs have something like “Jam\\\0n” the representation of the string result is ‘J’, ‘a’, ‘m’, ‘\\’, ‘\0’, ‘\n’, ?
Paul
Please how do I create a keyboard class attribute that is ‘multi’ functional? (Something else appears when a shift or control key is pressed) ?
Kathy Toepfer
Hello here
ɢᴀɴᴇꜱʜ
Does anyone know how to generate a simple program for mathematical expression y=mx + c
ɢᴀɴᴇꜱʜ
The thing is we have to use type casting
Eliezer
The thing is we have to use type casting
Do you have cast to integer?
LeBouy
a C program that accepts an integer as input and displays all the prime numbers smaller than or equal to that number
Anonymous
plz help me to find the error in thz c++ coding // reading a text file #include <iostream> #include <fstream> #include <string> using namespace std; int main(){ struct code_system{ char letter; char code[10]; }; FILE *filePointer; struct code_system cs; filePointer = fopen("morsecode.txt", "r"); if(filePointer==NULL){ cout<<"morsecode.txt file failed to open."; }else{ cout<<"The file is now opened."; cout<<"\nLETTER\tCODE"; cout<<"\n-----\t------\n"; cin>>filePointer; while(cs.letter !='*'){ cout<<"\n"<<cs.letter<<"\t"<<cs.code<<endl; cin>>filePointer; } fclose(filePointer); cout<<"\nData successfully read from file output2.txt.\n"; cout<<"The file is now closed"; } return 0; }
Sahil
a C program that accepts an integer as input and displays all the prime numbers smaller than or equal to that number
#include <stdio.h> #include <conio.h> int main() { int n,a,b; char input; printf("\n**Prime Number**\n"); printf("Enter series range : "); scanf("%d",&n); printf("\nPrime Number Series: \n"); for(a=2;a<=n;a++){ for(b=2;b<=a;b++){ if(a%b==0){ break; } } if(a==b){ printf("%d ",a); } } getch(); return 0; }
\Device\NUL
i wonder why do people still using non standard stuff when new learning C/C++
shriman_deepak
dx.ID = atoi(line.substr(0,3).c_str()); dx.Author = line.substr(4,16); dx.Title = line.substr(20,38); dx.Publisher = line.substr(41,50); dx.Year = atoi(line.substr(54,58).c_str()); dx.isbn = line.substr(57,75); here what is the purpose of digits in the bracket after substr ?
Sahil
conio.h and getch is non Standard
No, problem you can avoid.
Anonymous
can anyone help me about my c++ assignment?
Prince Of Persia
1.Copy in C code 2.Close C code 3.Open C++ code 4.Past in C++ code It works😅
Gilded
conio.h and getch is non Standard
conio.h has inputs in offline compiler windows so when compiling online have to remove it right and cant remove getch
\Device\NUL
conio.h has inputs in offline compiler windows so when compiling online have to remove it right and cant remove getch
But it's NOT STANDARD. There's no guarantee it can run on other platform. Why not getchar() instead ?
Roger
But it's NOT STANDARD. There's no guarantee it can run on other platform. Why not getchar() instead ?
https://stackoverflow.com/questions/8792317/where-is-the-conio-h-header-file-on-linux-why-cant-i-find-conio-h
Roger
can this way solve that problem (?
Roger
sudo apt-get install libncurses5-dev libncursesw5-dev
\Device\NUL
can this way solve that problem (?
I think no, because it's implementation are different
\Device\NUL
I think no, because it's implementation are different
Try in Windows/DOS #include <conio.h> getch() The program will wait the user input. But in Linux #include <ncurses.h> getch() I didn't input anything but the program is end`
Roger
did conio.h in bits/stdc++.h (?
\Device\NUL
No
\Device\NUL
Including <bits/stdc++.h> directly is also bad habit. https://www.quora.com/Is-it-good-practice-to-use-include-bits-stdc++-h-in-programming-contests-instead-of-listing-a-lot-of-includes
\Device\NUL
It didn't do anything since ++nl is outside control flow statemnt and while block
Prince Of Persia
> if (c =='\n'); This is the problem
Yeah the semicolon is the problem
Roger
lol , why type-int can be type-char
Roger
use stoi()
Prince Of Persia
lol , why type-int can be type-char
In C sizeof('a') == sizeof(int)
\Device\NUL
In C sizeof('a') == sizeof(int)
In C++ are not sizeof('a)' return char size
Prince Of Persia
In C++ are not sizeof('a)' return char size
👍 C++ does it like that But C doesn't Actually idk why C returns int size I'm a C++ programmer
\Device\NUL
use stoi()
Isn't stoi has pointer char parameter ? while getchar() return int
\Device\NUL
lol , why type-int can be type-char
Remember, there's integer promotion
Kaashᅠ
Anyone suggest the best Linux, should i go with.. For programming
Prince Of Persia
Anyone suggest the best Linux, should i go with.. For programming
Mostly all Linux distros are for programming I guess😕
Tushar
hey can anyone send their code in C on how to delete a key in hash table using linkedlists
Tushar
I am stuck in it
Adriano
Anyone suggest the best Linux, should i go with.. For programming
Probably Gentoo, as, from the start, you compile your entire system, so not only all the tools and libs will be there by the time you finish, but you'll understand a lot more about them.
Anshul
https://pastebin.com/8MQzyX9W this is the code that i wrote for the problem Mixtures on SPOJ, but it is giving me a wrong answer when i try to submit it. can anyone please tell me where am i going wrong?
\Device\NUL
thanks, will try soon😁..
I don't recommend source based distro unless you have specific reason like optimization, building stuff, etc. There's also Clear Linux that made by Intel and of course it's optimized for Intel CPU because -O3 and -march -mtune
Sahil
#include <stdio.h> #include <conio.h> int main() { int arr[3][5], i=0; for( i = 0; i < 5; i++) { printf("Enter Element[0][%d]: ",i); scanf("%d",&arr[0][i]); } i = 0; while(i<5) { printf("Enter Element[1][%d]: ",i); scanf("%d",&arr[1][i]); i++; } i=0; do { arr[2][i] = arr[0][i] * arr[1][i]; i++; }while(i<5); for( i = 0; i < 5; i++) { if(arr[2][i]%2 == 0) { printf("Element [2][%d]: %d (Prime Number)\n",i,arr[2][i]); } else { printf("Element [2][%d]: %d (Odd Number)\n",i,arr[2][i]); } } getch(); return 0; }
J
Anyone suggest the best Linux, should i go with.. For programming
I use Kernel 4.14 in android with Termux or Kernel 5.16 in arch Linux. (Or in most cases, it doesn't matter unless you have a particular hardware and want to utilise maximum of it. For example, If I am concerned about battery life and I have a Zen 2+ processor, I will stick with Kernel 5.17+)
Sonu
Write a program to display factorial of user entered number?
Sonu
Thanks for noone helping me😏
Sahil
Write a program to display factorial of user entered number?
// Program to print Factorial of a given number Using for loop. #include <stdio.h> int main() { int n; long factorial = 1; printf("Enter the number: "); scanf("%d",&n); for(int i = n; i >= 1; i-- ) { factorial *= i; } /* for(int i = 1; i <= n; i++ ) { factorial *= i; } */ printf("Factorial of %d is %ld.",n,factorial); return 0; }
Anonymous
1.Copy in C code 2.Close C code 3.Open C++ code 4.Past in C++ code It works😅
Plz help me to convert thz syntex to c++ #include<stdio.h> struct code_system{ char letter; char code[10]; }; int main(){ FILE *filePointer; struct code_system cs; filePointer=fopen("morsecode.txt", "r"); if(filePointer==NULL){ printf("morsecode.txt file failed to open."); }else{ printf("The file is now opened."); printf("\nLETTER\tCODE"); printf("\n-----\t------\n"); fscanf(filePointer,"\n%c %s",&cs.letter,cs.code); while(cs.letter !='*'){ printf("\n%c\t%s",cs.letter,cs.code); fscanf(filePointer,"\n%c %s",&cs.letter,cs.code); } fclose(filePointer); printf("\nData successfully read from file output2.txt.\n"); printf("The file is now closed"); } return 0; }
Sahil
Write a program to display factorial of user entered number?
// Program to print Factorial of a given number Using recursion. #include <stdio.h> long factorialFunc(int n); int main() { int n; long factorial; printf("Enter the number: "); scanf("%d",&n); factorial = factorialFunc(n); printf("Factorial of %d is %ld.",n,factorial); return 0; } long factorialFunc(int n) { long factorial = n; if(n==1 || n== 0){ return 1; } factorial = factorial* factorialFunc(n-1); return factorial; }
⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠⁠
Write a program to display factorial of user entered number?
We need to understand how to multiply them on string
Sergio
Hi, How can I get the following element in a bst?
King
How can I install C++ to my macbook pro 2014
Eirik
How can I install C++ to my macbook pro 2014
Idk Mac too well, but I'd assume it comes with Clang in Bash to run C++