CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Sun, 24 Aug 2025 09:09:33 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20080503075017
location: https://web.archive.org/web/20080503075017/https://www.daniweb.com/code/snippet803.html
server-timing: captures_list;dur=0.461020, exclusion.robots;dur=0.016667, exclusion.robots.policy;dur=0.007657, esindex;dur=0.010811, cdx.remote;dur=92.513237, LoadShardBlock;dur=201.445196, PetaboxLoader3.datanode;dur=68.074448, PetaboxLoader3.resolve;dur=44.597132
x-app-server: wwwb-app225
x-ts: 302
x-tr: 315
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app225; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Sun, 24 Aug 2025 09:09:34 GMT
content-type: text/html; charset=utf-8
x-archive-orig-date: Sat, 03 May 2008 07:50:16 GMT
x-archive-orig-server: Apache/2.2
x-archive-orig-x-powered-by: PHP/5.1.6
x-archive-orig-set-cookie: bblastactivity=0; expires=Sun, 03-May-2009 07:50:16 GMT; path=/; domain=.daniweb.com
x-archive-orig-cache-control: private
x-archive-orig-pragma: private
x-archive-orig-connection: close
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Sat, 03 May 2008 07:50:17 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Fri, 28 Mar 2008 16:42:39 GMT", ; rel="prev memento"; datetime="Tue, 01 Apr 2008 00:52:47 GMT", ; rel="memento"; datetime="Sat, 03 May 2008 07:50:17 GMT", ; rel="next memento"; datetime="Thu, 24 Jul 2008 04:33:01 GMT", ; rel="last memento"; datetime="Fri, 20 Feb 2009 02:36:17 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 51_3_20080503043738_crawl103-c/51_3_20080503074835_crawl104.arc.gz
server-timing: captures_list;dur=0.447052, exclusion.robots;dur=0.014858, exclusion.robots.policy;dur=0.007475, esindex;dur=0.010183, cdx.remote;dur=9.380460, LoadShardBlock;dur=165.913904, PetaboxLoader3.datanode;dur=141.623644, PetaboxLoader3.resolve;dur=110.414689, load_resource;dur=116.375562
x-app-server: wwwb-app225
x-ts: 200
x-tr: 357
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
Pascal Triangle Generator - cplusplus
Pascal Triangle Generator
•
•
•
•

What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 323,234 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,043 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
This program generates lines of pascal's triangle, numbers after 23 generate weird output.
#include <iostream> #include <stdlib.h> using namespace std; string Separator(" "); float factorial (float n) { if (n == 0.0f) return 1.0f; else if (n != 1.0f) return n*factorial (n-1.0f); else return n; } float combination (float n,float r) { return factorial(r)/((factorial(r-n)*factorial(n))); } void printRow(float r) { for (float i=0.0f; i<=r; i+=1.0f){ cout << combination (i,r) << Separator; } } void printRows(float r) { for (float j=0.0f; j<r; j+=1.0f){ printRow(j); cout << endl; } } int main(int argc, char** argv) { float nRows = 10.0f; cout << "Hello, This is me Pascal. I'll give you "; if (argv [1] == 0) cout << "10 Lines of my famous triangle"; else if (atof (argv [1]) <= 0.0f) cout << "10 Lines of my famous triangle"; else { nRows = atof(argv [1]); cout << argv [1] << (nRows > 1? " Lines " : " Line ") << "of my famous triangle.\n"; } printRows(nRows); }
Comments (Newest First)
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)
- Today's Posts
- Unanswered Threads
Related Features
DANIWEB FEATURE INDEX
ADVERTISEMENT
STATISTICS