Data Realms Fan Forums
http://45.55.195.193/

C++
http://45.55.195.193/viewtopic.php?f=7&t=8085
Page 1 of 3

Author:  Kelas [ Mon Oct 01, 2007 4:28 am ]
Post subject:  C++

Right, I am in a computer science class, and in said class, we are learning C++.

And I need some help.

Code:
#include <iostream>

int main()
{
    std::cout<<"Yes or no?\n";
    int choice;
    int yes;
    int no;
    std::cin>>choice;
    if (choice==yes){std::cout<<"Hello";}
    if (choice==no) {std::cout<<"Bye";}
    else {std::cout<<"PICK YES OR NO ladylike";}
    return 0;
}



It keeps on displaying the std::cout of the selected choice, AND the last if statement. (Note, I know there's and else command, it still did the same thing)(Ninja edit; I made it say else)

Also, to make this thread a bit more worthwhile, this will become the collaberative C++ "mini-community" thread thingy. Help eachother with C++, teach eachother, etc.

Author:  Alenth Eneil [ Mon Oct 01, 2007 4:40 am ]
Post subject:  Re: C++

Why are they all ints/not declared to a value etc.

Author:  whitty [ Mon Oct 01, 2007 4:44 am ]
Post subject:  Re: C++

whats the name of the class?

and i think int means... wait no it doesn't.

Author:  Kelas [ Mon Oct 01, 2007 4:44 am ]
Post subject:  Re: C++

Because that causes more errors and requires I declare more stuff.

Author:  Kelas [ Mon Oct 01, 2007 4:45 am ]
Post subject:  Re: C++

int means integer. I know. String doesn't work. At least we haven't learned it in class because it requires importing another library or some ♥♥♥♥ like that.

Author:  whitty [ Mon Oct 01, 2007 4:47 am ]
Post subject:  Re: C++

once again. what is the name of the class?

Author:  Alenth Eneil [ Mon Oct 01, 2007 4:47 am ]
Post subject:  Re: C++

Strings are shitty.

Anyways, you have nothing to ♥♥♥♥ compare to with that code, it will always say that you put in the wrong thing.

Author:  Kelas [ Mon Oct 01, 2007 4:48 am ]
Post subject:  Re: C++

whitty wrote:
once again. what is the name of the class?



Class? What now?

Author:  whitty [ Mon Oct 01, 2007 4:50 am ]
Post subject:  Re: C++

whats the name of your computer science class?
like object oriented programming, program scripting, what?

Author:  Alenth Eneil [ Mon Oct 01, 2007 4:50 am ]
Post subject:  Re: C++

What does that have to do with anything...

Author:  Kelas [ Mon Oct 01, 2007 4:51 am ]
Post subject:  Re: C++

Kelas wrote:
Right, I am in a computer science class, and in said class, we are learning C++.



Name=Computer Science.

Author:  Alenth Eneil [ Mon Oct 01, 2007 4:53 am ]
Post subject:  Re: C++

Still

Code:

#include <iostream>

int main()
{
    std::cout<<"Yes or no? (1||0)\n";
    int choice;
    int yes = 1;
    int no = 0;
    std::cin>>choice;
    if (choice==yes){std::cout<<"Hello";}
    if (choice==no) {std::cout<<"Bye";}
    else {std::cout<<"PICK 1 OR 0 ladylike";}
    return 0;
}



Then I realise I don't remember variables being set like that(cin), but C++ was a long time ago. Whatever.

Author:  whitty [ Mon Oct 01, 2007 4:54 am ]
Post subject:  Re: C++

k thanks.

@alenth:
i wanted to know so i can take that class next year XD

we have a comp. science class at my skewl yay

kelas:
tell people you'll teach them cortex command coding if they help you with that c++

wait but doesnt CC use c++ ?

Author:  Alenth Eneil [ Mon Oct 01, 2007 4:56 am ]
Post subject:  Re: C++

CC is done in C++, .inis are just variable lists.

Author:  Kelas [ Mon Oct 01, 2007 4:59 am ]
Post subject:  Re: C++

Alenth; this is with your code. Mine does the exact same thing.

Attachments:
File comment: The err.
Untitled.png
Untitled.png [ 32.1 KiB | Viewed 4862 times ]

Page 1 of 3 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/