Learned more about gdb's dprintf. Made some changes.

This commit is contained in:
Ernie Pasveer
2024-12-20 10:17:07 -06:00
parent bba66da1e7
commit 24fa6d6a7e
17 changed files with 195 additions and 14 deletions
@@ -0,0 +1,25 @@
#include <string>
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <stdarg.h>
int main (int argc, char** argv) {
int count = 10;
int nfact = 1;
int n;
// Add the 'dprintf' function to the program's symbol
// table. So we can use it for gdb's 'dprintf' breakpoints.
dprintf(1, " C++ loop\n");
for (n=1; n<=count; n++) {
nfact = nfact * n;
// printing the value of n and its factorial
std::cout << std::setw(12) << n << std::setw(14) << nfact << std::endl;
}
return 0;
}