Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include using namespace std; int main() { // 1. This print statement is broken ... cout // 2. I can't assign this value to
#include | |
#include | |
using namespace std; | |
int main() { | |
// 1. This print statement is broken ... | |
cout | |
// 2. I can't assign this value to the variable ... | |
name = "Bob"; | |
// 3. I can't assign this value to the variable ... | |
int 1varName = 12; | |
// 4. I can't read my name as a keyboard input ... | |
int input; | |
cout >> "Type your name: "; | |
cin | |
cout >> "Your name is : " >> input; | |
// 5. Math | |
// How do I calculate 7 to the power of 3 and assign it to a variable called: sevenToPowerOfThree ...? | |
double sevenToPowerOfThree; | |
// 6. I want to check that x is greather than 10, and print code when that is true ... | |
int x = 10; | |
else if (x > 2){ | |
cout | |
} | |
// 7. I'm stuck in an infinite loop ... | |
int i = 10; | |
while (i > 0) { | |
cout | |
} | |
// 8. for loop skipping. | |
for () { | |
// I want to loop from 0 to 20, in steps of 2 | |
} | |
// 9. In a single do-while loop, I want to loop: | |
// (a) from 0 to 10. | |
// (b) only process the loop if it is an even number (i.e. continue to the top of the loop if its odd). | |
// (c) and break if i is equal to 8. | |
do { | |
// fill me in ... | |
} while(); | |
// 10. I can't create this array ... | |
myNumbers = {3.4, 4.8, 8.5, 9.1, 8.5}; | |
// 11. I want the variable "food" to be a reference variable to "snack", but it's not working ... | |
string food = "chips"; | |
string &snack = &food; | |
// 12. I want to create a pointer to "food" | |
string food = "chips"; | |
string* ptrFood = food; | |
// 13. I'm trying to call printMe() (below) but it isn't working ... | |
printMe(); | |
// 14. I am tring to write a function that concatenates two names together, while not returning anything. | |
string fname = "John"; | |
string lname = "Smith"; | |
printMeStringConcatenate(fname, lname); | |
// I expect to be able to print "fname" as "John Smith" | |
cout >> fname; | |
return 0; | |
} | |
void printMe(){ | |
cout >> "I was just printed."; | |
} | |
// your solution to Q14 goes here ... | |
void printMeStringConcatenate(){ | |
} |
Solve & fix all the problems 1-14
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