#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; int main () { } Write a program that converts a numeric score (provided by the user) into a letter grade (A, B, C, D, or F). The point-to-letter conversion rules are as follows: score >= 90: A score >= 80 (but less than 90): B score >= 70 (but less than 80): C score >= 60 (but less than 70): D otherwise: F The completed program should produce console content as follows: Enter your...
#include <iostream> using namespace std; int main() { } Write a program that solicits a user-specified amount of numbers and their values, and then computes the average value, as well as their parity (how many even versus odd). Below is the console content of an example run of the completed program. How many numbers would you like to store? 8 Enter the 8 numbers: 0 7 3 1 5 6 2 3 Average value: 3.125 Parities: 3 even, 5 odd
#include <iostream> using namespace std; void drawTriangle(int w) {} int main() {} Complete the program so that it produces a centered, isosceles triangle of a user-specified width. For example: Enter a width: 5 Result: ***** *** *
#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; }
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