Question: I need help with C++ code can you fix my code? Here is my code #include #include #include using namespace std; int main() { //run

I need help with C++ code

can you fix my code?

Here is my code

#include #include #include using namespace std;

int main() {

//run an infinite loop until valid input is given int n = 0; while(true){ cout>n; if(n>= 1 && n

//form the file name in format times-table-n.txt string file = "times-table-"; file = file + c + ".txt";

// Create and open a text file ofstream MyFile(file);

//write the first line MyFile

//second line MyFile

MyFile

//write the table for(int i=1;i

// Close the file MyFile.close(); coutand here is an issue

I need help with C++ code can you fix my code? Here

is my code #include #include #include using namespace std; int main() {

5: Times Table 10 A Output is nearly correct; but whitespace differs. See highlights below. Special character legend Input 10 ---- 1 2 3 4 5 6 7 8 9 10 _ ---- 1 2 3 5 6 7 00 9 10 w NP 4 8 10 12 16 20 14 21 18 27 3 6 9 12 15 18 24 30 2 3 4 5 4 8 12 16 20 32 36 40 Your output 5 10 15 25 45 50 40 48 12 18 30 54 W NNN 60 7 7 3 35 42 56 70 14 16 21 24 28 32 63 72 8 2 48 56 80 lo OD 18 27 36 45 54 63 81 90 72 80 10 l 10 20 30 50 60 70 90 100 - ! ---+- 1 ---+ -- - ! 1 2 3 5 6 7 00 10 - ---- - - - - -- - 1 2 4 5 7 8 10 2 W NP 4 m 100 8 10 12 14 16 20 6 12 15 18 21 24 30 3 4 5 4 8 12 16 20 24 28 32 0) WN , 40 Expected output 10 15 20 25 30 35 40 50 0 0 12 18 24 30 36 42 48 54 60 7 7 14 21 28 35 42 49 56 0 0 70 8 8 16 24 32 40 48 56 64 18 27 36 45 63 72 9 10 9 10 54 60 72 80 81 90 90 100 20 30 40 50 70 80 ---- 6: Times Table 12 A Output is nearly correct; but whitespace differs. See highlights below. Special character legend Input 12 1 2 3 4 5 6 7 8 9 10 11 12 4 1 2 ] 3] 1 2 3 000 COO) AN 51 Your output 3 6 9 12 15 18 21 24 27 30 12 18 24 30 36 42 12 16 20 24 28 32 36 5 10 15 20 25 30 35 40 45 50 55 10 12 14 16 18 20 22 7 14 21 28 35 42 49 56 63 70 77 10 11 12 16 18 20 22 24 24 27 30 33 36 32 36 40 44 48 40 45 50 55 60 48 54 66 72 56 63 70 77 64 72 80 72 81 90 99 108 80 90 100 110 120 99 110 121 132 96 108 120 132 144 7 000 10 54 60 66 72 10 11 12 11 | 12 | 24 60 + x 1 2 3 4 5 6 7 8 9 10 11 12 4 1 ] 2 3 1 2 3 4 5 6 7 2 4 6 8 36 51 6 12 18 24 30 36 42 Expected output 3 6 9 12 15 18 21 24 27 30 33 36 12 16 20 24 28 32 36 40 10 12 14 16 18 20 22 24 20 25 30 35 40 45 50 55 60 7 14 21 28 35 42 49 56 63 70 8 10 11 12 16 18 20 22 24 24 27 30 33 32 36 40 44 48 40 45 50 55 60 48 54 66 72 56 63 70 77 84 64 72 80 72 81 90 99 108 80 90 100 110 120 88 99 110 121 132 96 108 120 132 144 oy 91 101 111 12 9 10 11 12 54 60 66 72 77 84

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!