#include <iostream>
using namespace std;
int main()
{
}
Write a program that, given a user-specified integer, prints out the next 10 integers (in increasing order; each on its own line).
For example, given an input of 3, the console content following a run of the completed program will look as follows:
Enter a number: 3
4
5
6
7
8
9
10
11
12
13
Please upvote if you like the answer, as it helps the community a lot.
Also if you have any doubts, feel free to ask in comments, we will reach you ASAP.
SOLUTION(ans.cpp):
#include <iostream>
using namespace std;
int main()
{
int i, n;
cout<<"Enter a number: ";
cin>>n;
// loop for printing next 10 numbers
for(i=n+1;i<=n+10;i++)
{
cout<<i<<endl;
}
return 0;
}
SAMPLE INPUT/OUTPUT:
Enter a number: 4
5
6
7
8
9
10
11
12
13
14
#include <iostream> using namespace std; int main() { } Write a program that, given a...
#include <iostream> using namespace std; int main() {} Write a program that produces a line comprised of n alternating a's and b's, where n is user-specified. For example, the console content following a run of the completed program with an input of "5" is as follows: Enter a number: 5 A line of length 5: ababa
#include <iostream> using namespace std; void drawTriangle(int x) {} int main() {} Complete the program so that it produces a right-angle triangle of a user-specified height. For example: Enter a height for the triangle: 5 Result: * ** *** **** *****
#include <iostream> using namespace std; void drawRect(int h, int w) {} int main() {} Write a program that produces h x w rectangles comprised of alternating columns of 1's and 0's (where h and w all user-specified). For example: Enter the desired dimensions for a rectangle: 6 4 Result: 1010 1010 1010 1010 1010 1010
Write following program using Switch statement. #include <iostream> using namespace std; int main() int number; cout << "Enter an integer cin >> number; if (number > B) cout << You entered a positive integer: " << number << endl; else if (number (8) cout<<"You entered a negative integer: " << number << endl; cout << "You entered e." << endl; cout << "This line is always printed." return 0;
This program illustrates dynamic variables #include <iostream> using namespace std; int main () { int *p1; p1 = new int; // Variables created using the new operator are called dynamic variables cout << "Enter an integer \n"; cin >> *p1; *p1 = *p1 + 7; cout << << "Your input + 7 = " << *p1 << endl; delete p1; // Delete the dynamic variable p1 and return the memory occupied by p1 to...
Write the missing statements for the following program. #include <iostream> using namespace std; int main(void) { int Num1; cout << "Enter 2 numbers: "; cin >> Num2; if (Num1 < Num2) cout << "Smallest number is " << Num1; else cout << "Smallest number is " << Num2; return 0; }
#include <iostream> using namespace std; int main() { int sumOdd = 0; // For accumulating odd numbers, init to 0 int sumEven = 0; // For accumulating even numbers, init to 0 int upperbound; // Sum from 1 to this upperbound // Prompt user for an upperbound cout << "Enter the upperbound: "; cin >> upperbound; // Use a loop to repeatedly add 1, 2, 3,..., up to upperbound int number =...
What prints here? # include <iostream> using namespace std; int main() -{int a = 7; bool b = a -2; cout <<" b is" << endl;} b is false Syntax error Wrong type for b. 1s 0 is true is 5 is 1
What is the output of this program? #include<iostream> using namespace std; int main() { int x=4, y=4, z=4; x += 2; y = z++; z = ++x + y; cout<<x<<" "<<y<<" "<<z<<endl; return 0; } Group of answer choices 4 4 4 7 4 11 7 5 12 6 5 11
Consider the following C++ program: #include <iostream> #include <cstdlib> using namespace std; int main int n =0; int i = 0; cout << "Please enter a strictly positive number:"; cin >> n if (n <= 0) exit(EXIT_FAILURE) while (n > 1) n-n/2; i << endl; cout"Output:" return 0; Answer the following questions: What is the output of the program for each of the following values of n: -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9? What does...