Anonymous
And also number of elements should something like 10 not "10"
ok thanks, anyway I realized now that instead of the "N" I have to put vett1. The name of the FILE * I provided. At least I think so.
HaiNahi
And for checking output of fopen you do if (file == NULL) printf("error");
Anonymous
ok
HaiNahi
Oh now i got it you meant if (N != NULL)
Anonymous
yes, but also: fread (votes, sizeof (int), "10", N); fwrite (average, sizeof (int), "10", N);
HaiNahi
I think you wanted to write N into the votes.dat fwrite(N, sizeof int, 10, vett1);
Anonymous
what is gui?
HaiNahi
Graphics
Vlad
What kind of black sorcery is this?
HaiNahi
Dosbox is slow but graphics.h is amazing :) but no threads in dosbox
HaiNahi
Why thats too simple atleast better than win32api with long codes
Vlad
Why thats too simple atleast better than win32api with long codes
What does winapi have to do with android gui?)
HaiNahi
Nothing I simply gave example
Manav
Never heard about graphics.h
Vlad
Never heard about graphics.h
It's a DOS header file
Vlad
Ye it's that old
Manav
It's a DOS header file
Oh wow, that's ancient
Manav
Why would anyone in their right minds use graphics.h ?
Manav
Does it give you those old dos GUI thingies?
Vlad
Why would anyone in their right minds use graphics.h ?
I dunno lol. For some reason it is still being taught
Vlad
At some Uni's
Manav
I dunno lol. For some reason it is still being taught
Oh I see, turboC shit? It's taught in some engineering colleges where I live
Botirjon
Hi everyone!
Botirjon
Who have telegram channel with books for c++
Manav
Nothing I simply gave example
If you want to have simple graphics, sdl/sfml is a good choice.
Botirjon
please share link with me
Manav
For Tui there is curses
Manav
He asked for android UI
Uhh, why not just use android SDK? 🤔
Vlad
Ye I know >graphics.h >android UI
HaiNahi
Uhh, why not just use android SDK? 🤔
You cant install android sdk in android
Manav
How can I do gui programming in android currently I use termux
Oh I see. I wouldn't recommend you do that. Termux though amazing is not a good place to do GUI programming. If you still want to stuff in it, use python with kivy or something. I haven't tested it personally but it should work
Vlad
You cant install android sdk in android
Well programming on an android device is a pain in the arse. Couldn't you get a pc?
Vlad
It is expensive :(
Well you can get a potato pc for coding for like a 200 usd or smth
Vlad
Not a biggie
Manav
It is expensive :(
Get a 2nd hand one from somewhere. Could even use raspberry pi for simple stuff 🤔
Manav
You will need adapters to connect to peripherals and repurpose tv as a monitor
HaiNahi
Well you can get a potato pc for coding for like a 200 usd or smth
I dont do job I have to convince my father for that :( I am still 17
Vlad
I dont do job I have to convince my father for that :( I am still 17
Actually it's easy. Say that it is essential for your carrier(which is true).
Vlad
Although I have no idea where do you live. Maybe 200 bucks is a lot for your country/region
Manav
Although I have no idea where do you live. Maybe 200 bucks is a lot for your country/region
Yep, it's about 17k inr To give you some perspective. A modest food for the whole day here would cost you about 500 inr
Manav
So that's 34 dinners?
Yep, a months salary for some people
Vlad
Difficult to cheat him
What do you mean by that?
Vlad
So that's 34 dinners?
Still manageable, imo
Manav
Difficult to cheat him
Why would it be cheating? Do you not want to pursue Computer science?
HaiNahi
Why would it be cheating? Do you not want to pursue Computer science?
He got the fact that atleast in high school I can code python in my phone (which I am learning now)
HaiNahi
🤦‍♂️
Again termux get it? :p
Vlad
And don't tell that your typing on a touch screen, or else I'll cringe
Manav
To do anything productive you need a computer, even your father would know that. If you don't know already civil engineering does involve some programming
Swapnil Kumar
Is there any group or channels in telegram to learn C/C++ in hindi language
Swapnil Kumar
Anybody please answer
William
Roshan
Hello! I've a question. I wanted to find the nearest number to a target and this is my approach: (1) subtract all the elements by target. (2) store the absolute value of the elements in a different array. (3) Find the index of the smallest number in the other array. (4) cout<< arr[index] Please say if my approach is correct.
Yazidi
#include <iostream> #include <string> using namespace std; int main () { int large, medium, small; char size; int num; int totalCups; cout << "Input the number of cups that you want: " << endl; cin >> num; int i = 1; do { cout << "select the size as shwon: (L,M,S): " << endl; cin >> size; switch(size) { case 'L': large++; break; case 'M': medium++; break; case 'S': small++; break; i++; } while (i <= num); totalCups = large + medium + small; } return totalCups; }
Anonymous
No problem
Yazidi
but it doesn't work with me !
Yazidi
does it work with u?!
Roshan
Now it's working as you wish. Sells i number of cups of size L, M, S
Roshan
*also correct the spelling of shwon -> shown
Roshan
Ehm... It's main() don't return totalCups
Yazidi
thanks to you, Roshan