Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C++ halp =/

Name: Anonymous 2007-06-12 10:52 ID:NALSuzi+

HAI
I'm learning some C++ and last night wrote this:

#include <iostream>
using namespace std;

int main()
{
    char gender[30];
    char fname[50];
    char sname[50];
    char hate[30];
    char wep[30];
    char hobby[50];
   
    cout<<"Please do not use spaces in your answer, it will mess up the program due to bad writing =/ "<<endl;
    cout<<endl;
    /* Yes I'm rubbish ok? */
    cout<<"Please enter either he/she, according to your gender: ";
    cin>> gender;
    cin.ignore();
    cout<<"And what is your first name?: ";
    cin>> fname;
    cout<<"Well hello there, "<< fname <<"! What is your surname?: ";
    cin>> sname;
    cin.ignore();
    cout<<"Thanks. So far you have told me that you are a "<< gender <<", and your name is "<< fname <<" "<< sname <<"."<<endl;
    cout<<endl;
    cout<<"What is the one thing you hate most?: ";
    cin>> hate;
    cin.ignore();
    cout<<"What is your weapon of choice?: ";
    cin>> wep;
    cin.ignore();
    cout<<"What is your favourite hobby/pastime?: ";
    cin>> hobby;
    cin.ignore();
    cout<<endl;
    cout<<"Ok, let's begin our story..."<<endl;
    cout<<endl;
    cout<<endl;
    cout<<""<< fname <<" "<< sname <<" thought "<< gender <<"'d take a break from "<< hobby <<"."<<endl;
    cout<<""<< gender <<" decided to rid the world of all traces of "<< hate <<", once and for all."<<endl;
    cout<<"So, brandishing a "<< wep <<", "<< gender <<" set off to seek out and destroy "<< hate <<"..."<<endl;
    cout<<"But "<< gender <<" died on the mission and "<< hate <<" remained forever more."<<endl;
    cout<<"Poor "<< fname <<", "<< gender <<" should have stuck with "<< hobby <<"."<<endl;
    cin.get();
   
    return 0;
}

As you can see, I'm a total n00b with only a basic knowledge of int, float and char. I was wondering which type i could use so that you choose one of 2 options, and most importantly, how I could allow spaces to be used in input without messing up how the program remembers it. Tried google but failed.

Name: Anonymous 2007-06-12 16:28 ID:xZgyyQaD

Seems to be more opposition to C++ as time goes by. Maybe it's getting old?

Personally I have mixed feelings about C++.

Sometimes I like how rigid it is, you really have to plan the structure of a program, the structures and the relationships and when you have your program finished it will be faster than most other langauges.

On the downside development using C++ is S L O W compared to other languages (I mean in the order of 10-100 times longer development times compared to using say Python).

So what's more important development time, or running time and  ego? ;)

(I'm >>16, I believe C++ has its uses but they are limited. Even game programmers are starting to use other languages (such as C#, could it be a dying language in a few years, or will the updates save it? (even though they have some nice changes I doubt it).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List