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

Pages: 1-

cin.getline?

Name: eko 2009-10-16 14:54

I'm a first year student and I study Computer Game Development.
Right now we are learning C++ among other things.

Is there a way to store numbers (int) into an array using something like cin.getline or getline(cin,x) for char arrays.
while typing I want to only separate the numbers with space.

Alternatively I could use a line like:
if(//case 'a' pressed)
    goto y;

Im stuck on this one, feel free to laugh at me

Name: TRUE TRUTH EXPERT !!TthtFzrtPXElUy7 2009-10-16 14:57

lOL GAME DEVELOPERS
DEVELOPERS DEVELOPERS
DEVELOPERS DEVELOPERS
DEVELOPERS DEVELOPERS
DEVELOPERS DEVELOPERS
DEVELOPERS DEVELOPERS
DEVELOPERS DEVELOPERS

Name: Anonymous 2009-10-16 15:14

Write it yourself

Name: TRUE TRUTH EXPERT !!TthtFzrtPXElUy7 2009-10-16 15:38

c++ PROGRAMMING IS ALL ABOUT TAKING ADVANTAGE OF THE HIGH LEVEL FEATURES c++ HAS TO OFFER. wHY THE HELL ARE YOU USING A POOR MANS CALL/CC?

Name: Anonymous 2009-10-16 16:23

While I will not help you with your homework, I will tell you that you should avoid the use of goto.

Name: Anonymous 2009-10-16 16:52

>>1
I'm a first year student and I study Computer Game Development.
Bonjour, motherfucker.
Lesson the first: Use the [code] tags. Thank you.

Name: Anonymous 2009-10-16 16:58

Computer Game Development
Enjoy your shitty hours and your contributions to the downward spiral of Gaming since the 1990s

Name: Anonymous 2009-10-16 19:24

instead of reinventing the wheel with lowlevel functionality such as 'cin' and friends, take advantage of the standard posix utilities, c++'s static typing and the preprocessor

something like this:

awk.sh:
awk 'BEGIN { print "int numbers[] = {" } { for (vv=1; vv<=NF; vv++) {print $vv ","; } } END { print "};"; }' > numbers.inc ; gcc -o main.exe main.cpp -lstdc++ ; ./main.exe

main.cpp:
#include <cstdio>
#include "numbers.inc"
#define LENGTH sizeof(numbers)/sizeof(int)
int main() { for (int i=0;i<LENGTH;i++) printf("%dth number is: %d\n", i, numbers[i]); return 0; }

example use:
Administrator@pc-001 ~/test
$ ./awk.sh
1 2 3 4
23 8945 67453
0th number is: 1
1th number is: 2
2th number is: 3
3th number is: 4
4th number is: 23
5th number is: 8945
6th number is: 67453

this is the [PURE FUNCTIONAL] way

Name: Anonymous 2009-10-16 19:51

Game developers ( ´_ゝ`)

Name: Anonymous 2009-10-16 22:54

man 3 scanf

Name: Anonymous 2009-10-17 10:43

java.util.Scanner

Name: Anonymous 2009-10-17 10:46

>>11
troll detected .

Name: Anonymous 2009-10-17 10:51

>>12
meta-troll detected .

Name: Anonymous 2009-10-17 10:53

>>13
higher order trollin', bru

Name: Anonymous 2009-10-17 10:59

>>14
A troll that takes a troll and returns a new troll?

Name: Anonymous 2009-10-17 11:31

>>15
void frozen(epic troll)

Name: Anonymous 2009-10-17 21:12

>>15
Wouldn't that break the encapsulation in object oriented trolling?

Name: Anonymous 2009-10-17 21:24

>>17


public class Poster
{
   public void intelligentPost(msgBoard board)
   {
      post(board, "Haskell would probably be good for that!");
   }
}

public class Troll extends Poster
{
   override public void intelligentPost(msgBoard board)
   {
      print(board, "LISP would probably be good for that!");
   }
}

public static void main(String [ ] args)
{
   int i;
   Poster anons[100];
   prog = new Board("http://dis.4chan.org/prog/");

   for (i = 0; i < 100; i++)
      anons[i] = new Troll();

   while(true)
   {
      for (i = 0; i < 100; i++)
          anons[i].post(prog);
   }
}

Name: Anonymous 2009-10-17 23:01

>>18
IHBT?

Name: Haxus the DEVELOPERS 2009-10-19 12:56

Haxus the DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS DEVELOPERS

Name: Anonymous 2009-10-19 13:19

I'm a first year student and I study Computer Game Development.

stopped reading right there.
obvious troll is obvious.

Name: Anonymous 2009-10-19 14:36

>>21
Back to the board whence you came, please.

We can tell.

Name: Anonymous 2009-10-19 14:39

>>22
back to /prog/ please.

Name: Anonymous 2009-10-19 19:02

>>22
i refuse to believe that programmers who are only interested in writing gaymans are real.
maybe i am in denial, but it is too horrible to believe that such people exist , especially on /prog/.

Name: Anonymous 2009-10-19 19:21

but it is too horrible to believe that such people exist
I find it difficult to believe that people don't care enough about English to capitalize their Is, but there you go.

Name: Anonymous 2009-10-19 19:50

>>25
hahahahahaha.
grammar faggots, in MY /prog/?
get back to gaia you pathetic SOB.

Name: Anonymous 2009-10-19 20:39

>>26
Your enigining?

Name: Anonymous 2009-10-19 21:16

>>23

I lol'd audibly.

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