Jump to content

  • Log In with Google      Sign In   
  • Create Account


Prefantastic

Member Since 29 Sep 2012
Offline Last Active Nov 06 2012 03:19 AM
-----

Posts I've Made

In Topic: How does somebody go about designing a program

06 November 2012 - 03:13 AM

One good way to outline a program, to determine the basic functions you might need, is to use a hierarchy chart. I can elaborate more if you'd like, but it basically has 4 Main points to the top tiers of the chart. You have the name of the program, basically what your goal is and what you want to output, then you break it into three categories;

Set up, run time, and finish. Under those three tiers, you branch out and consider what you would need, in it's most basic form, under each tier. Such as if you were to make a simple program run and execute "Hello world", you'd have the three main points branched under the "MAIN" function (using C jargon, forgive me if your forte is another language). The first step, you'd just want the simple print function to output the text "Hello world!", then you'd do your basic clean up stuff.

The main printing step would be under the first tier, and the finishing up "return" statement would be under the "finish" tier.

The main reason you'd use something like this is to neatly visualize the basics of how you want your program to function. It's extremely useful in larger projects so you can outline how you want each program to work. From there, you'd usually make a program skeleton then fill out the "meat and potatoes" of the rest of the program once you've decided which parts of the program you'd want to turn into functions, structures, classes, objects, etc, and what else would be just straight up code.

I'll try and add an example of what I mean in another post tomorrow if you would like one. As is, I'm pretty tired and I need to get up early tomorrow and figure out what's wrong with my eye... hopefully nothing bad. I need these eyes to be able to see my code. >;[

In Topic: So I've learned C...

05 November 2012 - 02:40 PM

Man. I love you guys so much. No matter what questions I throw out there, I always get a mass of intelligent people such as yourselves giving me your two-cents and leading me on to be a better programmer. I can't thank you guys enough for all of the patient guidance you guys have provided me within the last month-or-less of me being a member on this forum. I really hope that I can pay you guys back some how, be it some free-lance programming or even some sensual serenading (I was a music major before i switched to computers ;D).

As it stands now, I do believe I'll pick up Java as I'm learning more of c. I'm gonna continue to study C and maybe mess around and develop a bit of a Interactive Fiction style program game that's easy to go through and run but has some complexities that make the program more efficent.

But a curious question that has been bugging me for the last few months is this;

Is there a way to blend languages together? I had a recent conversation with a new found friend of mine, not a half hour ago (Mind you, I'm sitting in the student center at my local community college enjoying a nice, tachicardia-enducing energy drink) who spoke of ASP.net . He said that in the language they use a lot of C#. I responded "Do I need to learn C# to learn asp?" and he said firmly, "ASP is a language on it's own... It's very hard to explain."

So... yeah. I'm a bit confused as to his response, so I shall ask you, my fellow quick-witted, ingenious, and handsome bretheren...

Is there a way to use one programming language in another programming language? Such as being able to write C in Java... etc. etc.

And please do explain more about what he meant with ASP.

In Topic: What language does what?

21 October 2012 - 06:40 PM

Hey there, Monkayy, I had the same problem as you when I started looking for a programming language to learn a few months ago. I started with C++ and that seemed to get me along just fine. I spent like thirty dollars on a beginners guide for dummies to c++ and it displayed all of the basics with variables, functions, and some OOP (Object Oriented Programming) that got me started with my current major. I'm studying for a Bachelors (Possibly Masters or Doctorate), depending on my career path in the future, and have taken up classes in basic C. Learning C++ was a great choice since they're the same language, just more advanced features in c++, and am doing fine as is. I would definitely suggest learning something that's most comfortable for you with the syntax. I'd add more but I gotta go to work! I'll add more when I get back home if this post still has a pulse.

- Jarret

In Topic: Trying to write a basic D&D Character sheet program.

01 October 2012 - 01:44 AM

Oh and thank you, RulerofNothing, for the Roll code. You're code is the meat and potatoes of my program. Haha.

In Topic: Trying to write a basic D&D Character sheet program.

01 October 2012 - 01:41 AM

I actually just finished my basic character sheet program today. I wrote it in about an hour. I'm proud of myself since it does everything that I want it to do so far. I want to add a few more things to it as I tinker around with strings and arrays so I can add in some racial text (Such as if you're an elf, dwarf, etc etc) and then possibly add more to the application, like re-rolling certain stats and stuff. Here's my code, (Warning, it's kinda big)

/*
Program : CharacterSheet.ccp
Author : Charles Jarret Grassi
Date : 9/30/2012
Version : 1.0
Desc : A Dungeons and Dragons Character Ability Score
	   automated roller, using a 4d6 stat engine to
	   get even, balanced stats for the six categories;
	   Strength, Constitution, Dexterity, Intelligcen, Wisdom, and Charisma
	   <img src='http://public.gamedev.net//public/style_emoticons/<#EMO_DIR#>/biggrin.png' class='bbc_emoticon' alt=':D' /> Use it wisely!

Soon to come : - Add "Host and Player" lines to the top
			   - Add Races, Background, and Equipment
			   - Add a secondary program; "Encounters"
			   - A name Randomizer
			   - Editable interface.
*/
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <time.h>
using namespace std;
int main()
{
	FILE * pFile;
	pFile = fopen("CharacterSheet.txt","w");
	fprintf(pFile, " DUNGEONS & DRAGONS - Character Sheet ");
	fprintf(pFile, "\n\n Strength:   Modifier [ ] ");
	fprintf(pFile, "\n\n Dexterity:   Modifier [ ] ");
	fprintf(pFile, "\n\n Constitution:   Modifier [ ] ");
	fprintf(pFile, "\n\n Intelligence:   Modifier [ ] ");
	fprintf(pFile, "\n\n Wisdom:   Modifier [ ] ");
	fprintf(pFile, "\n\n Charisma:   Modifier [ ] \n");
	int nInput;
	printf("\n\n Welcome to the Dungeons and Dragons AP roller! ");
	printf("\nThe program has been executed and is storing stats ");
	printf("inside of a 'character.txt' file inside this folder.");
	printf("\n\n You will recieve the raw ability scores with the ");
	printf("modifiers beside the stat. You may allocate the stats");
	printf("within any core stat you may like. If you have recieved");
	printf("a bad score, exit the program and run it again. :3 ");
	printf("\n\n If you wish to save this sheet without deleting the stats");
	printf(", make sure you change the name of the text file before running");
	printf(" the program again, otherwise it will delete all of the data stored");
	printf(" inside the text file and write over it. <img src='http://public.gamedev.net//public/style_emoticons/<#EMO_DIR#>/biggrin.png' class='bbc_emoticon' alt=':D' /> ");
	printf("\n\n======Developed by Dragon Master INC.======");
	printf("\n\n Press 0 to exit the program. Press any other key to continue. ");
	scanf("%d", &nInput);
	if(nInput == 0)
	{
		exit(0);
	}
	srand( time(NULL) );
	for(int nAccu = 0; nAccu < 6; ++nAccu)
	{
		int nMod;
		int nStat = 0;
		int nMin = 7;
		for(int nAccumulator = 0; nAccumulator < 4; nAccumulator++)
		{
			printf("\n\n Rolling...");
			// Make sure not to seed a rand inside of a loop
			// the results will be the same every time.
			int nRoll = rand() % 6 + 1;
			cout << "\n nRoll = " << nRoll;
			if(nRoll < nMin)
			{
				nMin = nRoll;
			}
			nStat += nRoll;
		}
		nStat -= nMin;
		printf("\n\n Stat : %d \n\n", nStat);
		nMod = (nStat - 10)/2;
		printf(" Modifier : %d \n\n", nMod);
		printf(" Outer Loop Accu : %d \n\n", nAccu);
		fprintf(pFile, "\n Stat : %d \n Modifier : %d \n ", nStat, nMod);
		// Listing the stats on the page via switching. (Neater. <img src='http://public.gamedev.net//public/style_emoticons/<#EMO_DIR#>/biggrin.png' class='bbc_emoticon' alt=':D' />)
	}
	fclose(pFile);
	printf("\n\n\n !END!");
	system("PAUSE");
	return(0);
}

If you can't already tell, it just uses some basic loops to generate the rolls, stores them in the stat and then prints them all to a text file. My friends were extremely impressed since they don't know how to program. I felt like a badass. But yeah, I'm going to study these class functions that you were describing and hopefully tinker around with them so they make sense to me. xD

-Edit-

I apologize if my coding is sort of sloppy. I threw it together while in a crunch to start building character sheets for my friends, and instead of doing things the easy way and just rolling stats, I had to make things harder for myself and make a program to do it. xD. So any comments that don't seem to fit, just ignore them. I had differnet mind sets on how I wanted the stats to be printed onto the text file, such as using a switch inside the loop to print out each stat name with the rolled stat and modifier, but it ended up printing out each stat six times which didn't work, so I just threw the stat names down at the top of the program just to be neat.

PARTNERS