samtwheels wrote:
nathanprocks wrote:
I have been wanted to learn c++ for ages but I couldn't be bothered learning. Can i join.
sure! make sure you get a little knowledge online or something.
Yeah thanks... I know a bit of HTML, BASIC, Visual Basic, dos batch scripting, scratch and maybe a couple of other stuff... So what is the first project you are planning?...
Oh... I forgot... My mum is using the family computer and the Internet for tafe homework and I fixed my Windows laptop by installing Linux so I can't use that...
Offline
Just so you know guys, I can't use visual C++ anymore cause my dad deleted it. I'll be using a different one.
Offline
got code::blocks.
Offline
bump.
Offline
nathanprocks wrote:
Ok I hope I can get a linux version
![]()
Ok. I'll start on the OS today. What should we call it?
Offline
Started programming. How about "Geek OS"? I made it a constant, so it is easily editable in the code.
Offline
veggieman001 wrote:
Wait is it a real operating system?
no. It just runs in a MS-DOS window. I will make a few changes and upload the source code tomorrow.
Offline
samtwheels wrote:
veggieman001 wrote:
Wait is it a real operating system?
no. It just runs in a MS-DOS window. I will make a few changes and upload the source code tomorrow.
lol what about... SHOCK! OS... lol the sad thing is that i use Ubuntu on my laptop now but maybe i can use my mum's computer
Offline
Hm… without the LotR and KH references, Bolt OS? Flood OS?
Offline
I like Bolt. I'll upload now.
Offline
Here it is. Bolt OS
Last edited by samtwheels (2011-12-01 16:34:53)
Offline
I'm having trouble with the download; can you just post the source code, without requiring us to download the cpp file? If you don't want random people to see it, they can just click the link too.
Last edited by maxskywalker (2011-12-03 09:33:44)
Offline
maxskywalker wrote:
I'm having trouble with the download; can you just post the source code, without requiring us to download the cpp file? If you don't want random people to see it, they can just click the link too.
It's open source, so I can deal with random downloads. also, if the code gets long, putting it online could result in too big posts. I'll do it later, though.
Offline
Here:
//OS project, by our software development company.
//Put any comments on changes we should make up here.
#include <iostream>
//defines OS name
#define NAME "Bolt"
//allows string variables.
#include <string>
//use namespace and declare variables
using namespace std;
int command;
int op1;
int op2;
bool codeNameExists = false;
string letter;
string number;
string codename;
void getCommand(void) //gets a command from the user.
{
std::cout << "\n>>";
std::cin >> command;
if (command != 4){ //Code to test for shutdown
if (command == 1){
cout << "Operand 1: ";
cin >> op1;
cout << "Operand 2: ";
cin >> op2;
cout << op1 + op2 << " is the answer.";
}
if (command == 2){
cout << NAME << " OS was created by a group of \n Scratchers in the Miscellaneous forums.";
}
if (command == 3){
if (codeNameExists){
cout << "Your current codename is: " << codename << endl;
}
cout << "What would you like your letter to be?";
cin >> letter;
cout << "\nWhat would you like your number to be?";
cin >> number;
codename = letter + number;
cout << "Your codename is " << codename << endl;
codeNameExists = true;
}
getCommand();
}
}
int main() { //main program, not much body so far
//welcome the user.
//when we have a name, add it in.
cout << "Welcome to " << NAME << " OS.\nKey:\n1: addition calculator\n2: About\n3: Codename\n4: Shutdown System ";
getCommand();
}Offline
bump.
Offline
Alright thanks! I just copied this (haven't read much yet; I'll do that when I paste it into Code::Blocks), so thanks for doing this for me.
Edit: I just read it. It's not bad. For the calculator, might I suggest getting rid of the op1 and op2 variables (keep reading to see why)? I wrote a calculator program, which I'd be glad to give to Bolt OS. Here it is:
#ifndef CALCULATOR_H_INCLUDED
#define CALCULATOR_H_INCLUDED
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
// This revision adds default values and void functions.
void add (double num1=0.0, double num2=0.0, string input="0")
{
cout << "This: ";
cin >> input;
stringstream(input) >> num1;
cout << "plus this: ";
cin >> input;
stringstream(input) >> num2;
double answer = num1 + num2;
cout << num1 << " + " << num2 << " = " << answer;
}
void sub (double num1=0.0, double num2=0.0, string input="0")
{
cout << "This: ";
cin >> input;
stringstream(input) >> num1;
cout << "minus this: ";
cin >> input;
stringstream(input) >> num2;
double answer = num1 - num2;
cout << num1 << " - " << num2 << " = " << answer;
}
void mul (double num1=0.0, double num2=0.0, string input="0")
{
cout << "This: ";
cin >> input;
stringstream(input) >> num1;
cout << "times this: ";
cin >> input;
stringstream(input) >> num2;
double answer = num1 * num2;
cout << num1 << " * " << num2 << " = " << answer;
}
void div (double num1=0.0, double num2=0.0, string input="0")
{
cout << "This: ";
cin >> input;
stringstream(input) >> num1;
cout << "divided by this: ";
cin >> input;
stringstream(input) >> num2;
double answer = num1 / num2;
cout << num1 << " / " << num2 << " = " << answer;
}
int main ()
{
string input;
short loop = 1;
while (loop == 1)
{
cout << "\n1) Add\n2) Subtract\n3) Multiply\n4) Divide\n5) Exit\n\nWhat would you like to do?\n";
cin >> input;
if (input == "1")
{
add ();
continue;
}
else if (input == "2")
{
sub ();
continue;
}
else if (input == "3")
{
mul ();
continue;
}
else if (input == "4")
{
div ();
continue;
}
else if (input == "5" || input == "quit")
{
loop = 0;
break;
return 0;
}
else
{
cout << "That is not a valid operation. Please use the number listed with the operation you would like to preform.\n";
continue;
}
}
}
#endif // CALCULATOR_H_INCLUDEDSorry that I don't use comments really. I never really expect to share my code. But I think it should be self explanatory enough. I've edited it so that you can just add it to the file directory and #include ".h" it. Here's the code with the refined calculator:
//OS project, by our software development company.
//Put any comments on changes we should make up here.
#include <iostream>
//defines OS name
#define NAME "Bolt"
//allows string variables.
#include <string>
#include "Calculator.h"
//use namespace and declare variables
using namespace std;
int command;
int op1;
int op2;
bool codeNameExists = false;
string letter;
string number;
string codename;
void getCommand(void) //gets a command from the user.
{
std::cout << "\n>>";
std::cin >> command;
if (command != 4){ //Code to test for shutdown
if (command == 1){
calc ();
}
if (command == 2){
cout << NAME << " OS was created by a group of \n Scratchers in the Miscellaneous forums.";
}
if (command == 3){
if (codeNameExists){
cout << "Your current codename is: " << codename << endl;
}
cout << "What would you like your letter to be?";
cin >> letter;
cout << "\nWhat would you like your number to be?";
cin >> number;
codename = letter + number;
cout << "Your codename is " << codename << endl;
codeNameExists = true;
}
getCommand();
}
}
int main() { //main program, not much body so far
//welcome the user.
//when we have a name, add it in.
cout << "Welcome to " << NAME << " OS.\nKey:\n1: addition calculator\n2: About\n3: Codename\n4: Shutdown System ";
getCommand();
}Well, I think it's about time to hit Submit, considering I've had the Edit screen open for like 10 mins. Hope you like it.
Last edited by maxskywalker (2011-12-03 16:36:41)
Offline
Ignore this post. (Mods, please don't delete this. It's not spam. It had a purpose)
Last edited by maxskywalker (2011-12-04 09:44:07)
Offline
samtwheels wrote:
maxskywalker wrote:
I'm having trouble with the download; can you just post the source code, without requiring us to download the cpp file? If you don't want random people to see it, they can just click the link too.
It's open source, so I can deal with random downloads. also, if the code gets long, putting it online could result in too big posts. I'll do it later, though.
The code would be just the same length, and the posts don't get too long because of the [ code ] tags. Am I missing something? If I'm the only one who really needs it, why should anyone else care? I'll deal with it.
Offline
Okay, seriously. The only people who have ever posted on this other than 'can I join?' are me and samtwheels. And I'm the only one who's posted in 2 days!
Offline
Okay, this is getting ridiculous. It's been 4 days.
Offline
maxskywalker wrote:
Okay, this is getting ridiculous. It's been 4 days.
Sorry about that. I'll modify the code now.
Offline