I need guidance on creating a single tone oscillator that can be switched on/off rapidly

I haven’t written programs since VB3 years ago, I have just started to learn C++
Any guidance or pointers would be most appreciated. Thanks