Author Topic: Learning C++! :D  (Read 3315 times)

Hello, I'm Zuero, and I've taken an interest in C++ coding.

If anyone would like to give any tips, please do.
I just started doing C++ so I won't have any huge programs.

Programs:

DayTeller - This program tells you what day it is when you edit the code.

Download:
http://www.megaupload.com/?d=PO38PU6A

Code:
Quote
#include <iostream>
int main()
{
    enum Days { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, INSERTDAYHERE };

    Days today;
    today = INSERTDAYHERE;

    if (today == Sunday)
        std::cout << "\nToday is Sunday.\n";
    if (today == Monday)
        std::cout << "\nToday is Monday.\n";
    if (today == Tuesday)
        std::cout << "\nToday is Tuesday.\n";
    if (today == Wednesday)
        std::cout << "\nToday is Wednesday.\n";
    if (today == Thursday)
        std::cout << "\nToday is Thursday.\n";
    if (today == Friday)
        std::cout << "\nToday is Friday.\n";
    if (today == Saturday)
        std::cout << "\nToday is Saturday.\n";
    if (today == INSERTDAYHERE)
        std::cout << "\nYou need to set what day it is in the code!\n";

    int x;
    std::cin >>x;
    return 0;
}

Oh, and one of my 1st code things:

Quote
//First self script
#include <iostream>
int main()
{
   std::cout << "Hello Blockland Forums!\n";
   std::cout << std::endl;
   std::cout << "I am learning how to code C++, and this is my first self made program!\n";
   std::cout << std::endl;
   std::cout << "Wish me luck!\n";
   std::cout << std::endl;
   std::cout << "-Zuero\n";
   int x;
   std::cin >>x;
   return 0;
}

JimHello - This is a program that took a while to fix the bugs.
Credits: Blaman for helping me with the 2nd bug, where when you put a letter in it
would tell you to press any key to exit the program.

Download: http://www.megaupload.com/?d=PNTK88GQ
« Last Edit: September 04, 2011, 09:57:24 PM by Zuero »

that's my grade in science


Code: [Select]
//////////////////////
//BEGIN ROOM OF GIRL//
/*Turn of lantern and do effect when entering room with altar lamp
 */
void CollideLightsOut(string &in asParent, string &in asChild, int alState)
{
SetLanternActive(false, true);
SetLanternDisabled(true);

PlaySoundAtEntity("eek", "scare_whine_loop3", "Player", 0.5f, false);
PlaySoundAtEntity("screaaaam", "12_girl_scream.snt", "Player", 1.0f, false);

StartScreenShake(0.5f, 0.01f, 0.1f, 0.02f);

PlayMusic("12_event_blood.ogg", false, 1.0f, 0.0f, 10, true);

CreateParticleSystemAtEntity("petals1", "ps_rose_petals.ps", "AreaPedals_1", false);

RemoveTimer("TimerGirlCry");

AddTimer("lights1", 0.05, "TimerLightsOut");
AddTimer("lights2", 0.2, "TimerLightsOut");
AddTimer("lights3", 0.6, "TimerLightsOut");
AddTimer("lights4", 1.2, "TimerLightsOut");
AddTimer("lights5", 1.5, "TimerLightsOut");
AddTimer("lights6", 2.5, "TimerLightsOut");
AddTimer("lightssps", 4.0, "TimerLightsOut");
AddTimer("lightsq", 10, "TimerLightsOut");
}
/*Shake, show blood, scream for the event
 */
void TimerLightsOut(string &in asTimer)
{
if(asTimer == "lights1"){
CreateParticleSystemAtEntity("petals2", "ps_rose_petals.ps", "AreaPedals_2", false);
StartPlayerLookAt("AreaLightsOut", 2.0f, 2.0f, "");
MovePlayerHeadPos(0.0f, -1.0f, 0.0f, 0.5f, 0.5f);
GiveSanityDamage(20.f, false);
FadeRadialBlurTo(0.1f, 0.025f);
SetRadialBlurStartDist(0.2f);
SetLampLit("altar_lamp_1", true, true);
PlaySoundAtEntity("thunmp", "scare_thump_flash", "Player", 0.0f, false);
}
else if(asTimer == "lights2"){
CreateParticleSystemAtEntity("petals3", "ps_rose_petals.ps", "AreaPedals_3", false);
CreateParticleSystemAtEntity("petals31", "ps_rose_petals.ps", "AreaPedals_1", false);
SetLanternDisabled(false);
PlaySoundAtEntity("thunmp", "scare_tingeling", "Player", 0.0f, false);
StartScreenShake(0.7f, 0.1f, 0.05f, 0.02f);
StopMusic(8.0f, 10);
}
else if(asTimer == "lights3"){
CreateParticleSystemAtEntity("petals4", "ps_rose_petals.ps", "AreaPedals_4", false);
PlaySoundAtEntity("scare1", "react_scare", "Player", 0.5f, false);
StartScreenShake(1.0f, 0.01f, 0.05f, 0.1f);
}
else if(asTimer == "lights4"){
CreateParticleSystemAtEntity("petals5", "ps_rose_petals.ps", "AreaPedals_2", false);
PlaySoundAtEntity("creak", "00_creak", "Player", 2, false);
StartScreenShake(0.3f, 0.01f, 0.05f, 0.02f);
MovePlayerHeadPos(0.0f, 0.0f, 0.0f, 0.2f, 0.2f);
}
else if(asTimer == "lights5"){
CreateParticleSystemAtEntity("petals41", "ps_rose_petals.ps", "AreaPedals_4", false);
StartScreenShake(0.7f, 0.02f, 0.05f, 0.05f);
PlaySoundAtEntity("scare2", "react_scare", "Player", 0.75f, false);
}
else if(asTimer == "lights6"){
StartScreenShake(0.7f, 0.02f, 0.05f, 0.05f);
PlaySoundAtEntity("scare1", "react_scare", "Player", 0.5f, false);
FadeSepiaColorTo(0, 0.1f);
FadeRadialBlurTo(0, 0.1f);
StopPlayerLookAt();
StopSound("eek", 1.0f);
}
else if(asTimer == "lightssps"){
for(int i=1;i<=2;i++) DestroyParticleSystem("BloodParticle_"+i);
for(int i=1;i<=4;i++) StopSound("BloodSound_"+i, 0.0f);
StopSound("creak", 4.0f);
}
//else if(asTimer == "lightsq"){ CompleteQuest("12Trail","12Trail");}
}

void InteractCloth(string &in asEntity)
{
PlayGuiSound("12_cloth.snt", 0.9f);
//AddTimer(asEntity, 1.0f, "TimerClothOn");

//if(GetLocalVarInt("TouchedCloth") == 1) return;

StartEffectEmotionFlash("Ch01Level12", "SignGirlCloth", "ui_insanity_touch.snt");

//SetLocalVarInt("TouchedCloth", 1);

//SetMessage("Ch01Level12", "SignGirlCloth", 0);
}
void TimerClothOn(string &in asTimer)
{
SetEntityPlayerInteractCallback(asTimer, "InteractCloth", true);
}
//END ROOM OF GIRL//
////////////////////

Tell me how this works.



the forget

It's from Storage level of Amnesia: The Dark Descent.

-snip-

Tell me how this works.
It works using a lot of classes and functions not inside this code.

Oooh, I've got a guide from MS for this.
After I get Torque, Lua, and Cube script down, this is next.

So far the only computer language I know is BASIC, I am starting to learn C# then C and this last.

Oooh, I've got a guide from MS for this.
After I get Torque, Lua, and Cube script down, this is next.
i got a whole 851 page book (not counting credit and stuff like that)

So far the only computer language I know is BASIC, I am starting to learn C# then C and this last.
Visual basic is pretty different from the original BASIC.

Visual basic is pretty different from the original BASIC.
i dont like visual basic that much

Tom

Right now your doing simple stuff. Things will get a whole lot harder when you start making things that are actually useful.

So far the only computer language I know is BASIC, I am starting to learn C# then C and this last.
I thought you knew VisualBasic.

Right now your doing simple stuff. Things will get a whole lot harder when you start making things that are actually useful.
I thought you knew VisualBasic.
i know
this book said i will learn it in 21 days and im on day 4