Question 1 (15 marks) Refer to the inputs and outputs in Figure 1, complete the Program 1 with appropriate C++ input or
Posted: Wed Apr 27, 2022 3:05 pm
Urgent help please I only have 1 hours to complete this, please clearly write the answers
Question 1 (15 marks) Refer to the inputs and outputs in Figure 1, complete the Program 1 with appropriate C++ input or output formatting. i.e setw, setprecision and fixed. **Note: one cell represents one space per digit or character. Write your answer in Table 1. Line Inputs 14 School of Computing 16 Cryptography Line Outputs 17 S с h 0 O 1 с r у р t O g r a р hy 18 5 1 1 0 20 4 7 5 7 8 7 9 6 3 3 21 А m i n a h P a a h а n g Figure 1 1 //Program 1 2 #include <iostream> 3 #include <string> 4 #include <iomanip> 5 using namespace std; 6 7 int main() 8 9 string subject, schoolName; 10 int x=5, y=10; 11 double dx=47.5698, dy=879.635; 12 string name = "Aminah", state = "Pahang"; 13 14 cin>> ; //enter "School of Computing" (1mark) 15 cin.ignore _);// (2marks) 16 getline ( );// enter "Cryptography" (2marks) 17 cout << schoolName << "\t"<< subject << endl; 18 Icout << <<<< <<y<< endl; // (2marks) 19 cout << ;// (2marks) 20 cout << << dx << << dy<< endl;// (2marks)
Question 1 (15 marks) Refer to the inputs and outputs in Figure 1, complete the Program 1 with appropriate C++ input or output formatting. i.e setw, setprecision and fixed. **Note: one cell represents one space per digit or character. Write your answer in Table 1. Line Inputs 14 School of Computing 16 Cryptography Line Outputs 17 S с h 0 O 1 с r у р t O g r a р hy 18 5 1 1 0 20 4 7 5 7 8 7 9 6 3 3 21 А m i n a h P a a h а n g Figure 1 1 //Program 1 2 #include <iostream> 3 #include <string> 4 #include <iomanip> 5 using namespace std; 6 7 int main() 8 9 string subject, schoolName; 10 int x=5, y=10; 11 double dx=47.5698, dy=879.635; 12 string name = "Aminah", state = "Pahang"; 13 14 cin>> ; //enter "School of Computing" (1mark) 15 cin.ignore _);// (2marks) 16 getline ( );// enter "Cryptography" (2marks) 17 cout << schoolName << "\t"<< subject << endl; 18 Icout << <<<< <<y<< endl; // (2marks) 19 cout << ;// (2marks) 20 cout << << dx << << dy<< endl;// (2marks)