Alignant
I was probably confused by this lot :D
Alignant
Buuut, I think I understood the most of what's going on, gread job 😅
BinaryByter
Oh yea, that's the aml interpreter
BinaryByter
Aml is bad
BinaryByter
Dima
Lol whos afraid of endianness
Alignant
https://en.wikipedia.org/wiki/Lilliput_and_Blefuscu#History_and_politics
Btw
Alignant
TL;DR
ctrl+F -> endian
BinaryByter
Alignant
Lets kill endianness
You may tell as about your problems if it'll make you feel better ^_^
Dima
*angry and bumbling faces of old-school devs* v(^_^v)♪
Anonymous
D
best advacned computer architecture ebooks , dealing with sandy bridge ?
Jaikishan
Thank you.
Jaikishan
It's link for discussion related to c/c++ used in crypto currency
Mat
You can ask without the link
Anonymous
Hello!
Anonymous
#include <iostream>
#include <fstream>
int main(){
std::ifstream infile;
infile.open("sum.in");
int sum;;
if(infile.fail()){
std::cout<<"Can't read file";
} else {
infile.close();
}
std::cout<<sum;
return 0;
}
Anonymous
So I am working on a small piece of code to read two numbers from a file then write the sum of them to another file called "sum.out"
Anonymous
I've opened the file but now I don't know how to read and sum the numbers.
Anonymous
Can someone give me a hint please?
Anonymous
@ollirz
#include <iostream>
#include <fstream>
int main(){
std::ifstream infile;
infile.open("sum.in");
int sum = 0;
if(infile.fail()){
std::cout<<"Can't read file";
} else {
std::string s;
while(infile>>s) {
std::cout<<s<<std::endl;
}
infile.close();
}
return 0;
}
Anonymous
Think I am much closer now. 😁
Anonymous
So now I need to use stoi to convert those two numbers I have in my file and add them to the sum variable?
olli
Anonymous
I asked a question here no reply
Anonymous
I have another question
Dima
lol
Anonymous
Which lib do you use for image viewer
Anonymous
And how can I do that
Dima
you can try bximg
Anonymous
Where can I get the documentation for that?
Anonymous
Can't find that? Bximg, pls a link
Anonymous
i'm unable to type
Anonymous
@ollirz I did it! :) Any way to improve this?
#include <iostream>
#include <fstream>
int main(){
std::ifstream infile;
infile.open("sum.in");
int sum;
if(infile.fail()){
std::cout<<"Can't read file";
} else {
int x;
while(infile>>x) {
sum +=x;
}
std::ofstream outfile;
outfile.open("sum.out");
outfile<<sum;
infile.close();
outfile.close();
}
return 0;
}
Dima
Anonymous
Thanks for the help @ollirz 😁
olli
Thanks for the help @ollirz 😁
👍 You're welcome :)
Make sure to initialize your variables, set sum to zero in the beginning. Otherwise sum might contain any random value.
Anonymous
Yes, the online judge I am using just notified me of that error. 😂
olli
Great! :D which judge are you using?
Anonymous
@ollirz https://www.pbinfo.ro/ (it's only in Romanian) I am starting with a local one mainly because the problems there are much simpler than on codeforces and other sites.
Anonymous
Anonymous
dudes , this crap is driving me crazy
Anonymous
when I type more than 1 char
Anonymous
the symbol ">" shows up from nowhere in the error message
Anonymous
and I actually can't even understand how the heck that happens
Anonymous
even if I type more than 1 char but the function is supposed to give me back the first 1
Anonymous
and the variable is of type char which could hold 1 char
Anonymous
I mean if I was using scanf to get a string , I'd say it might overflowed the memory and pushed a random number to the error string
Anonymous
but getchar is supposed to give back a char
Dima
Dima
pseudohack
Anonymous
pseudohack
I am not sure what pseudohack mean
yeah its crappy code , but its not the issue here
Kevin
❤️😘😍💋
Kevin
💦
Kevin
🍆💦💦
Ludovic 'Archivist'
int first_use = 1;
if (first_use == 1)
Ludovic 'Archivist'
Really
Ariana
XD
BinaryByter
Alignant
🍆💦💦
Is that a dick joke? :c
BinaryByter
somehow operator- isn't found
BinaryByter
Making reverse_iterator not work on that one
BinaryByter
BinaryByter
Any ideas on how I can make this shit work?
olli
BinaryByter
olli
no your function needs to be const
A operator + (<whatever>) const;
BinaryByter
Oh
BinaryByter
Works!
BinaryByter
Thank you a lot!
olli
you're welcome :)
BinaryByter
Thankq :D
Faisal
Can any one give me some best min project for data structure using C.
BinaryByter
data structures