almost 10 years

I'm going to post here when I can't figure out certain aspects of Java. I don't know how many of you know the language well, but help will be appreciated as I go through this bootcamp.

Also an excuse for me to post a countdown until Doomsday.

If you code, what language do you prefer?
19
Python
13
C++
10
Java
5
Other
4
Ruby
4
Combo (the right answer)
3
C# (lol)
2
Javascript
deletedalmost 10 years

Oksus says

int main()
{
int x;
cin >> x;

for (x > 20; x++)
{
cout << x;
}



return 0;
}
and if i dont decalre it in the loop, like this, the code wont run at all.
This is why i need help xD


can't you do for(x=x; x>20; x++)

you should note that if x is greater than 20, then you have an infinite loop.
almost 10 years
You have to declare the variable type before you assign it? In Java it would be int x = System.in or whatever, but I don't see how it would run because I would think the compiler would break at int x since it's not doing anything but declaring the type rather than assigning a value.
deletedalmost 10 years

Togepi says

Idk who you are but hi!!


wtf im me
deletedalmost 10 years
int main()
{
int x;
cin >> x;

for (x > 20; x++)
{
cout << x;
}



return 0;
}
and if i dont decalre it in the loop, like this, the code wont run at all.
This is why i need help xD
deletedalmost 10 years
Because I have to declare x before I cin>> x; and I want to do it outside the loop
almost 10 years
Idk who you are but hi!!
almost 10 years
i can help with codogings.

semicolons. ;;;;;;;;
almost 10 years
hi
almost 10 years
Ayyyyeeeee
almost 10 years
toge
almost 10 years
hi
almost 10 years
Why are you declaring x twice? You're instantiating it once outside of the loop and then again in the scope of the loop.
deletedalmost 10 years
int main()
{
int x;
cin >> x;

for (int x; x > 20; x++)
{
cout << x;
}


return 0;
}
almost 10 years
Can you show me the code? Can't really give advice without seeing it.
deletedalmost 10 years
there is, but for some reason when I do it, the code doesnt work the way it should.
Only happens in a for loop
almost 10 years

Sims says


Togepi says

I don't write C++, but is cin >> user input?


yes


Is there no way to assign the input to a variable and call it in the loop with that?
deletedalmost 10 years
Still loving Ruby & Rails. Pounding away at Rails like a sailor who just got back to shore after six months pounds at a hooker's diseased snatch.
almost 10 years
This happened in my Python class today... WTF...

http://puu.sh/n5SpF/67dc0d4627.png
almost 10 years

Togepi says

I don't write C++, but is cin >> user input?


yes
almost 10 years
Holy crap has it really almost been 30 days? ._.
deletedalmost 10 years
People who are choosing python are probably casual as
almost 10 years
I don't write C++, but is cin >> user input?
deletedalmost 10 years
Not home right now
deletedalmost 10 years
Uhh copy paste your code that isn't working
deletedalmost 10 years

Togepi says

I am a loop master.


Mind explaining the For loop to me in c++.
I have this problem where i cannot get it to work unless i specify the value before.
If I want to input the value using cin >>, for some reason it won't register properly in the for loop.