Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab 12 Due Date: See Blackboard Source File: /2336/12/lab12. CCICPP l cpplc++Icclcxxl cp) Input: Output Value: under control of main function under control of main
Lab 12 Due Date: See Blackboard Source File: /2336/12/lab12. CCICPP l cpplc++Icclcxxl cp) Input: Output Value: under control of main function under control of main function Write a recursive function that prints a nonnegative long integer with commas in the correct locations. For example, it should print 20131 as 20,131. A sample main function for testing your function is shown in Figure 1. Commands to compile, link, and run this assignment are shown in Figure 2. To use the Makefile as distributed in class, add a target of lab12 to targets2srcfiles 1 #include #include s using namespace std; 7 void insertComma (unsigned long num, ostream& os) int main unsigned long ul; 12 s while (cin > ul) cout cd 2336 2 newuser csunix /2336> ./getlab.ksh 12 3 * Checking to see if a folder exists for Lab 12. . "No *Creating a folder for Lab 12 Checking to see if Lab 12 has sample input and output files. . .Yes Copying input and output files for Lab 12 from folder /usr/local/2336/data/12 to folder ./12 Checking to see if /usr/local/2336/src/lab12main.C exists.. .Yes Copying file /usr/local/2336/src/1ab12main . C to folder ./12 9 * Checking to see if /usr/local/2336/include/1ab12.h exists. . .No 41Copying file /usr/local/2336/src/Makefile to folder /12 12Adding a target of lab12 to targets2srcfiles 13Touching file./12/1ab12.cpp 4 Edit file ./12/1ab12.cpp in Notepad++ s newuser@csunix /2336> cd 12 6 newuser@csunix /2336/12> 1s Makefile 01.dat 18 newuser@csunix /2336/12> make lab12 9 g++ -g -Wall-std-c++11lab12main.c -I/usr/local/2336/include -I 2 g++ -g -Wall-std-c++11 lab12.cpp -I/usr/local/2336/include I 21 g+t -o lab12 lab12main.o lab12.o -L/usr/local/2336/1ib -1m -lbits 22 newuserQcsunix /2336/12> cat 01.dat 23 0 1 12 234 3302 12345 123456 1234567 12345678 123456789 1234567890 24 2147483647 1000000000 25 newuserQcsunix /2336/12> cat 01.dat I ./1ab12 01.out lab12.cpp b12main.c 1212 234 -234 3302 3,302 12345-12,348 123456 123,456 1234567 1,234,567 34 12345678 12,345,678 35 123456789123,456,789 e 12345678901,234,567,890 37 2147483647 2,147,483,647 as 10000000001,000,000,000 39 newuser@csunix /2336/12> cat 01.dat I ./lab12 > my.out 40 newu 41 newuserQcsunix /2336/12> serocsunix -/2336/12> diff 01.out my.out Figure 2. Commands to Compile, Link, & Run Lab 12 #include #include domanip> using namespace std; void insertComma (unsigned long num, ostream& os) char ch =so.fill(); //save a copy of the current fill character os
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started