|
| 23 Sep 2015 10:15 AM |
#include "iostream"
int main(){ std::cout<<"Yep"; return 0; } |
|
|
| Report Abuse |
|
|
Anonynoum
|
  |
| Joined: 03 Aug 2015 |
| Total Posts: 230 |
|
|
| 23 Sep 2015 10:16 AM |
C++ is inefficient
let the flame games begin |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2015 10:17 AM |
ur rite, BASIC is bettr
hurdest langwage in da wurld |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2015 10:17 AM |
your program would instantly close as soon as it opens. Consider:
#include "iostream"
int main(){ std::cout << "Yep" << std::endl; std::cin.get(); return 0; } |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2015 10:18 AM |
| BTW C++ is like my profession |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2015 10:19 AM |
Pop quiz:
When you want a value from an array, you use array_name[n]. This is actually shorthand. What is another way you can write that statement? |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2015 10:21 AM |
| you could use an std::vector instead and access it like x.at(index) |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2015 10:22 AM |
| depends what kind of value you're trying to get though.. |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2015 10:24 AM |
No. I'll give you a hint.
*array_name
and
array_name[0]
mean the same thing |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2015 10:26 AM |
i knew that, but I kept thinking what use is the very first element xD |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2015 11:51 AM |
I guess since no one knows, here's the answer.
Also I made a typo, I mean that *array_name[0] and array_name are the same. They're the same because arrays are just pointers to the first item in an array.
So, you can rewrite array_name[n] as *(array_name+n). This is because array_name points to the memory address of array_name[0], so if we add n onto it, we get the address of array_name[n], and we then pull the memory from that address using the * operator.
for (int i=0; i<10; i++) std::cout << *(array_name+i) << "\n";
That will display the first ten elements in array "array_name". |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2015 11:53 AM |
c++ is trash, pythino ftw
Sorry, my GJOST cat typed that |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Sep 2015 12:19 PM |
c++ should be called c- mahhahahha
Sorry, my GJOST cat typed that |
|
|
| Report Abuse |
|
|
redlego98
|
  |
| Joined: 11 Jul 2008 |
| Total Posts: 8870 |
|
|
| 23 Sep 2015 12:20 PM |
Javascript + HTML/CSS > all
A strange game. The only winning move is not to play. |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2015 12:20 PM |
Comparing web langiages to OOP language
Genius! |
|
|
| Report Abuse |
|
|
|
| 23 Sep 2015 12:21 PM |
JavaScript is amazing. Especially when you combine it with NodeJS and PhantomJS.
You can essentially create anything web-related with it.
Plus, with Google Chrome's new app system, you can now even create desktop applications in JavaScript that run cross-platform. |
|
|
| Report Abuse |
|
|
| |
|