Nicolas 2000
It's a household name
Een bestand is een geheugenplaats op de harde schijf, een variabele is een geheugenplaats in het ram.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Voegen jullie ook stap voor stap controles in of het programma goed wordt uitgevoerd?
Dat deed ik wel op kritieke punten in de code. Dan kon ik tussenresultaten in het proces controleren. In de definitieve versie kun je die 'outcommenten'Voegen jullie ook stap voor stap controles in of het programma goed wordt uitgevoerd? In veel voorbeelden zie ik dat...
#include <iostream>
#include <cmath>
#include <chrono>
#include <thread>
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
constexpr int n_samples = 25;
constexpr int st = 1000;
constexpr double delta = (2.0 * M_PI)/n_samples;
int main() {
for (int j = 1; j < 10; j++){
for (float i = 0; i < n_samples; i++){
float result = i/n_samples;
//std::cout << "Output = " << result << std::endl;
for (int i = 0; i < 20*result + n_samples; i++){
std::cout << '*';
}
std::cout << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(st));
}
}
return 0;
}
Zoals het voorbeeld.Hier is mijn zaagtand programmaatje:
Code:#include <iostream> #include <cmath> #include <chrono> #include <thread> #ifndef M_PI #define M_PI 3.14159265358979323846 #endif constexpr int n_samples = 25; constexpr int st = 1000; constexpr double delta = (2.0 * M_PI)/n_samples; int main() { for (int j = 1; j < 10; j++){ for (float i = 0; i < n_samples; i++){ float result = i/n_samples; //std::cout << "Output = " << result << std::endl; for (int i = 0; i < 20*result + n_samples; i++){ std::cout << '*'; } std::cout << std::endl; std::this_thread::sleep_for(std::chrono::milliseconds(st)); } } return 0; }
Hoe is jouw debug code daarin te verwerken?
Juist,En dat zet je dan uit of aan door "#define DEBUG" al dan niet uit te commentariëren?
kleine toevoegingEn dat zet je dan uit of aan door "#define DEBUG" al dan niet uit te commentariëren?