Page 1 of 1

refresher course in code

Posted: 16 Dec 2018, 05:55
by gnuuser
well its been a long time since I wrote any amount of code due to my former job and raising a family :oops:
so I guess Im going to take some classes in code again. :T
c#, java, python. and maybe php for starters and more later :tux5:

Re: refresher course in code

Posted: 17 Dec 2018, 23:24
by viking60
:s

Re: refresher course in code

Posted: 01 Dec 2019, 04:59
by gnuuser
heres a quick one in c++ it calculates the size of a hdd by the parameter you type in and displays the size in megabytes.
integers (a,b,c ) and it works :jackpot :A

#include <iostream>
using namespace std;

int main()
{
int a = 35202;
int b = 16;
int c = 63;
int d = 512;
int e = 1024;
int f = 1024;
int sum = a * b * c * d / e / f;
// this is just a down and dirty hdd size calculator.

cout << sum;

return 0;
}

Re: refresher course in code

Posted: 01 Dec 2019, 06:27
by R_Head
Is all Ellinik√° to me. :lol:

Re: refresher course in code

Posted: 11 Dec 2019, 19:19
by dedanna1029
gnuuser wrote:heres a quick one in c++ it calculates the size of a hdd by the parameter you type in and displays the size in megabytes.
integers (a,b,c ) and it works :jackpot :A

#include <iostream>
using namespace std;

int main()
{
int a = 35202;
int b = 16;
int c = 63;
int d = 512;
int e = 1024;
int f = 1024;
int sum = a * b * c * d / e / f;
// this is just a down and dirty hdd size calculator.

cout << sum;

return 0;
}


Can this be set somehow to display gigabytes?

Re: refresher course in code

Posted: 20 Dec 2019, 03:11
by gnuuser
after line int f add line with int g = 1000;
int sum = a * b * c * d / e / f / g; ( the g has been added here)
and it should work
int a is the number of cylinders, int b is the number of heads, and int c is the number of sectors.

Re: refresher course in code

Posted: 31 Dec 2019, 20:24
by dedanna1029
Thanks!