Anonymous
why don't copy the code in here or paste it on ideone or pastebin or somethin?
Anonymous
okl
aura_
Can anybody suggest best book to buy for learning programming for beginners . I am new in this group plz help
Anonymous
ok
Anonymous
Can anybody suggest best book to buy for learning programming for beginners . I am new in this group plz help
my principal, there's many good reads on the internet and all of it are free...
Anonymous
#include<iostream> #include<fstream> #include<string> #include<math.h> using namespace std; int main() { ifstream obj("student.csv"); if(!obj.is_open()) std::cout<<"File Open "<<endl; int avg,total,eng,mat,sci; string name; string english; eng=stoi(english); string math; mat=stoi(math); string science; sci=stoi(science); while(obj.good()) { getline(obj,name,','); getline(obj,english,','); getline(obj,math,','); getline(obj,science); total=(eng+mat+sci); cout<<name<<" Your total Marks are :"<<total; } }
Deni
Not, it not type safe
Ah lol, i've always used that to convert
Anonymous
Thnx
don't mention it
aura_
Ok
Anonymous
it used to have pdf version.. dunno where the file gone...
Anonymous
brb
Anonymous
anyone with networking PDF?
olli
codeblocks
That's your IDE/Editor. Not your compiler..
Anonymous
Anonymous
how can I know about my compiler?
aura_
Thnx
Anonymous
its gnu gcc
olli
how can I know about my compiler?
I would suggest to add the flag as described here https://stackoverflow.com/a/24398366
Deni
codeblocks
I remember that with codeblocks you can enable c++11
Anonymous
ok I am doing it now
Anonymous
@Akkuq oh yeah, it wasn't cover the latest C++ version but it'll give you very good of most fundamentals of C++ (and some other things were added and modified in the latest C++)
aura_
Yup I am waiting 😊
Anonymous
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Anonymous
I got this error
Anonymous
aura_
It will
Anonymous
you can find your own resources for C++ and C++11
olli
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
You're probaby passing an invalid string to stoi std::invalid_argument if no conversion could be performed
Deni
#include <iostream> #include <string> int main(){ std::string b="1"; int a=std::stoi(b); std::cout<<a; }
Deni
Result: 1
Deni
This code on rextester works
Anonymous
I am tryng to get data from csv file and convert it to integer
olli
the string you're trying to convert probably contains not digits only
Anonymous
math.h header is not a C++ one , use #include <cmath>
Anonymous
Ok
Anonymous
#include<iostream> #include<string> #include<fstream> using namespace std; int main() { string name,eng,math,science; ofstream marks; marks.open("student.csv"); marks<<"Name"<<","<<"English"<<","<<"math"<<","<<"science"<<endl; for(int i=0; i<5; i++) { cout<<"Enter your name :"; getline(cin, name); cout<<"Enter Marks obtained in Subjects given :"<<endl; cout<<"English: "<<endl; getline(cin, eng); cout<<"Math: "<<endl; getline(cin, math); cout<<"Science: "<<endl; getline(cin, science); marks<<name<<","<<eng<<","<<math<<","<<science<<endl; } }
Anonymous
I created my database from this code
Anonymous
#include <iostream> using namespace std; void seclection(int arr[],int siz); int main() { int arr[]={77,5,43,23,56,78,98,76,54,32,34,56,7,89,87,65,4}; int size= sizeof(arr)/sizeof(arr[0]); seclection(arr,size); for(int i=0;i<20;i++){ cout << arr[i] << " "; } return 0; } void seclection(int arr[],int siz){ int i,j,k,t,c; for(i=0;i<siz;i++){ k=arr[i]; for(j=i+1;j<siz;j++){ if(arr[j] < k){ k=arr[j]; c=j; } } t= arr[j]; arr[j]=arr[i]; arr[i]=arr[j]; } }
Anonymous
i am trying to make seclection sort
Ubeid
Hey guys.. thanks so much for creating this group! I've studied basic of C language at uni last year, and i wanna learn more! I use my phone, can u recommand any app for Android?
Dima
Why mobile/android tho?
Anonymous
problem solved
Anonymous
applications built by c++ wont stay on screen
Anonymous
disappers quickly
Ubeid
Why mobile/android tho?
Maybe it's the device i use all the time!
Ubeid
Sure
Deni
Sure
You can program in C++ on Android with ndk, but i council to use only Java for Android and use C++ only for the optimization of the app
Anonymous
#include<iostream> #include<fstream> #include<string> #include<cmath> #include<cstdio> using namespace std; int main() { ifstream obj("student.csv"); if(!obj.is_open()) std::cout<<"File Open "<<endl; int avg,total,eng,mat,sci; string name; string english; string math; string science; while(obj.good()) { getline(obj,name,','); getline(obj,english,','); getline(obj,math,','); getline(obj,science); eng=stoi(english); mat=stoi(math); sci=stoi(science); total=(eng+mat+sci); avg=total/3; cout<<name<<" Your total Marks are :"<<total<<" Average marks are :"<<avg<<endl; ofstream average; average.open("Final Marksheet.csv"); average<<"Name"<<","<<"English"<<","<<"Mathematics"<<","<<"Science"<<endl; for(int i=0; i<5; i++) { average<<name<<","<<eng<<","<<mat<<","<<sci<<","<<avg<<endl; } } getchar(); return 0; }
Anonymous
name is not getting in final csv file
Anonymous
pls help
Talula
🙏👍 i appriciate your tips
I would suggest using Xamarine actually, it's easier than C++ and uses NDK so it's faster.
Ubeid
I would suggest using Xamarine actually, it's easier than C++ and uses NDK so it's faster.
But if i choose, i would start from the scratch, and be back in the 1st squere! Thanks for your suggest
Talula
But if i choose, i would start from the scratch, and be back in the 1st squere! Thanks for your suggest
True, but if it's a fresh start, I would have suggested doing it in C# as most of the classes are ready to run on Android and you can port the same program to iOS with minimal changes... which makes it great.
Anonymous
can I use auto v{1,2,3}; in c++11 ?
Anonymous
Hello there! I have a question regarding using Regular Expressions in C++. So, + in regex means repentance of the preceding character one or more times and [abc] means any of the character inside [] that is any of the char from a, b and c will match. Following from the above two [abc]+ should match any string containing only arbitrary number of a, b and c that is, aabbbbc, acccc, accccbbb, bbc, etc all will match. Also ' . ' is a wildcard character that matches any character and whitespace except newline.Am I right till here? I hope so, if not please correct me. Now to match a string "Hello\n I am a C++ programmer" I wrote the regex [.\n]+ and it did not work. But when I changed it to .+\n.+ to my surprise it worked then. Can anyone tell me what am I doing wrong?
Anonymous
Inside a character class everything except ^, -, ] or \ is always a literal. [.]{3} therefore only matches ...
Thanks Olli. Can you tell me a good resource to learn regex, the source from where I learnt regex did not teach me this.
olli
Thanks Olli. Can you tell me a good resource to learn regex, the source from where I learnt regex did not teach me this.
I would recommend getting to know the rules by Wikipedia (https://en.wikipedia.org/wiki/Regular_expression#Standards)and play with regex on a site like https://regex101.com/ to get good visualization and understanding of how things work. Regex101 provides an explanation for your current expression. Don't know whether this helps you though
olli
Thank you.
You're welcome :)
Ս
HI everyone!
Ս
who can help we with understanding a code?
Ս
https://paste.fedoraproject.org/paste/KxYdPHI~1QamFhIQIDtnDA
Saurabh
Which is the best python book for reading?
klimi
?
Surya
Okk
Anonymous
Which is the best python book for reading?
This is not a Python group but I would suggest Learning Python by O Reilly
Anonymous
Hello people! I am learning Exception Handling in C++ using Bjarne Stroustrup's C++ Programming Language. There is one particular line that intrigues me "The author of the Library knows how to detect an exception but not what to do with it. This is left to the user of the Library." And I could not think of a situation where such a thing would happen. I did come up with an example though, suppose I am writing a C++ Library to provide Restful Web API service, now if somehow the connection is lost or API service is temporarily unavailable the program should raise exception because although the author of the Library knows that some exception has occurred, he does not know what to do with it, such as freeing some resource dependent on the API or printing an error message. But I don't know how accurate this example is, I am an undergraduate student and have never written Production Level code in C++ or any other language. I would be glad if someone can give some insight relating to a real world example. Thank you.