This is an old revision of the document!


Teaching C++

main.cpp

#include <iostream>
using namespace std;

int main()
{
  int value = 0;
  cout << "Enter an integer: ";
  cin >> value;
  cout << "You entered: " << value << endl;
  return 0;
}

build.sh

gcc main.cpp -lstdc++ -o hello

Practice

Compute the range of the projectile.

angleR = angleD * Pi / 180.0;
range = sin(2.0 * angleR) * pow(velocity, 2) / gravity;
wiki/ideas/teaching.1271941097.txt.gz · Last modified: 2020/11/19 14:21 (external edit)
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0