// task-01
#include
using namespace std;
int main()
{
int input;
cout << "Enter the test score between 1 and 10:" << endl;
cin >> input;
while (input < 0 || input > 10)
{
cout << "INVALID INPUT:!" << endl;
cout << "Again Enter the test score between 1 nd 10: " << endl;
cin >> input;
}
return 0;
}
#include
using namespace std;
int main()
{
cout << "How many stars to print: as square ";
int howMany;
cin >> howMany;
cout << "Following are " << howMany << " stars" << endl;
int i=1;
while(i<=howMany)
{
int j=1;
while(j<=howMany)
{
cout<<"*";
j++;
}
cout<
_________________________________________________________________
How many stars to print: as a triangle 7
Following are 7 stars
*
**
***
****
*****
******
*******
#include
using namespace std;
int main()
{
cout << "How many stars to print: as a triangle ";
int howMany;
cin >> howMany;
cout << "Following are " << howMany << " stars" << endl;
int i=1;
while(i<=howMany)
{
int j=1;
while(j<=i)
{
cout<<"*";
j++;
}
cout<
using namespace std;
int main()
{
cout << "How many stars to print: as a triangle ";
int howMany;
cin >> howMany;
cout << "Following are " << howMany << " stars" << endl;
int i = howMany;
while (i >= 1)
{
int j = 1;
while (j <= i)
{
cout << "*";
j++;
}
cout << endl;
i--;
}
cout << endl;
return 0;
}
___________________________________________________________________________
Horizontal Image of triangle
How many stars to print: as a triangle 7
Following are 7 stars
*******
******
*****
****
***
**
*
#include
using namespace std;
int main()
{
cout << "How many stars to print: as a triangle ";
int howMany;
cin >> howMany;
cout << "Following are " << howMany << " stars" << endl;
int i = 0;
while (i < howMany)
{
int j = 1;
while (j <= howMany)
{
if (j <= i)
{
cout << " ";
}
else
{
cout << "*";
}
j++;
}
cout << endl;
i++;
}
cout << endl;
return 0;
}
___________________________________________________________________________
Output as:
Enter a number :
7
*
***
*****
*******
*********
***********
*************
_____________________________________________________
#include
using namespace std;
int main()
{
int n;
cout<<"Enter a number :"<>n;
int i=0;
while(i=(n-i) && j<=(n+i)))
{
cout<<"*";
}
else
{
cout<<" ";
}
j++;
}
cout<
#include
using namespace std;
int main()
{
int num;
int sum = 0;
while (num >= 0)
{
cout << "Enter a number :" << endl;
cin >> num;
if (num >= 0)
{
sum = sum + num;
}
}
cout << "The sum of all the above positive numbers = " << sum << endl;
return 0;
}
#include
#include
using namespace std;
int main()
{
double num1;
double num2;
double cal;
cout << "_______________________________________" << endl;
cout << "----------Simple Calculator------------" << endl;
cout << "_______________________________________" << endl;
cout << endl;
cout << "Enter a number 1 :" << endl;
cin >> num1;
cout << "Enter a number 2 :" << endl;
cin >> num2;
cout << "Press + to add the enter Numbers :" << endl;
cout << "Press - to subtract the enter Numbers :" << endl;
cout << "Press * to Multiply the enter Numbers :" << endl;
cout << "Press / to divide the enter Numbers :" << endl;
char ch = getch();
switch (ch)
{
case '+':
{
cal = num1 + num2;
cout << "The addition of the " << num1 << " and " << num2 << " = " << cal << endl;
break;
}
case '-':
{
cal = num1 - num2;
cout << "The subtarction of the " << num1 << " and " << num2 << " = " << cal << endl;
break;
}
case '*':
{
cal = num1 * num2;
cout << "The multiplication of the " << num1 << " and " << num2 << " = " << cal << endl;
break;
}
case '/':
{
cal = num1 / num2;
cout << "The division of the " << num1 << " and " << num2 << " = " << cal << endl;
break;
}
}
return 0;
}
#include
using namespace std;
int main()
{
int size = 100;
char ch[size];
cout << "Enter the string :" << endl;
cin.getline(ch, size);
int n = 0;
int i = 0;
while (ch[i] != '\0')
{
switch (ch[i])
{
case 'a':
{
cout << "The vowel " << ch[i] << " is present at " << i << " index ." << endl;
n++;
break;
}
case 'e':
{
cout << "The vowel " << ch[i] << " is present at " << i << " index ." << endl;
n++;
break;
}
case 'i':
{
cout << "The vowel " << ch[i] << " is present at " << i << " index ." << endl;
n++;
break;
}
case 'o':
{
cout << "The vowel " << ch[i] << " is present at " << i << " index ." << endl;
n++;
break;
}
case 'u':
{
cout << "The vowel " << ch[i] << " is present at " << i << " index ." << endl;
n++;
break;
}
case 'A':
{
cout << "The vowel " << ch[i] << " is present at " << i << " index ." << endl;
n++;
break;
}
case 'E':
{
cout << "The vowel " << ch[i] << " is present at " << i << " index ." << endl;
n++;
break;
}
case 'I':
{
cout << "The vowel " << ch[i] << " is present at " << i << " index ." << endl;
n++;
break;
}
case 'O':
{
cout << "The vowel " << ch[i] << " is present at " << i << " index ." << endl;
n++;
break;
}
case 'U':
{
cout << "The vowel " << ch[i] << " is present at " << i << " index ." << endl;
n++;
break;
}
}
i++;
}
cout<<"The total vowels in the string \""<
#include
using namespace std;
int main()
{
int table;
int n = 1;
cout<<"Table of 10 "<
#include
using namespace std;
int main()
{
int num;
cout<<"Enter a number:"<>num;
for(int i=0;i=num-i){
cout<<"*";
}
else{
cout<<" ";
}
}
cout<
#include
using namespace std;
int main()
{
int num;
cout<<"Enter a number:"<>num;
for(int i=0;i=num-i){
cout<<"*";
}
else{
cout<<" ";
}
}
cout<=0;i--){
for(int j=1;j<(2*num);j++){
if(j<=num+i && j>=num-i){
cout<<"*";
}
else{
cout<<" ";
}
}
cout<
#include
using namespace std;
int main()
{
int num;
cout<<"Enter a number:"<>num;
for(int i=0;i=0;i--){
for(int j=1;j<(2*num);j++){
if(j==num-i || j==num+i){
cout<<"*";
}
else{
cout<<" ";
}
}
cout<
#include
using namespace std;
int main()
{
int num;
cout<<"Enter a number:"<>num;
for(int i=0;i=0;i--){
for(int j=1;j<(2*num);j++){
if(j==num){
cout<<"*";
}
else{
cout<<" ";
}
}
cout<
Enter a number:
10
********* *********
******** ********
******* *******
****** ******
***** *****
**** ****
*** ***
** **
* *
* *
** **
*** ***
**** ****
***** *****
****** ******
******* *******
******** ********
********* *********
#include
using namespace std;
int main()
{
int num;
cout<<"Enter a number:"<>num;
for(int i=0;i=num-i){
cout<<" ";
}
else{
cout<<"*";
}
}
if(i==num-1){
break;
}
cout<=0;i--){
for(int j=1;j<(2*num);j++){
if(j<=num+i && j>=num-i){
cout<<" ";
}
else{
cout<<"*";
}
}
cout<
#include
using namespace std;
int main()
{
int num;
cout << "Enter the number:" << endl;
cin >> num;
for (int i = 1; i <= num; i++)
{
for (int j = 0; j < i; j++)
{
cout << "*";
}
cout << endl;
}
for (int i = num - 1; i > 0; i--)
{
for (int j = 0; j < i; j++)
{
cout << "*";
}
cout << endl;
}
return 0;
}
out put as:
Enter the number:
10
*
**
***
****
*****
******
*******
********
*********
**********
*********
********
*******
******
*****
****
***
**
*
#include
#include
#include
using namespace std;
int main()
{
int x = time(0);
srand(x);
int compGuess;
int userGuess;
bool flag = false;
cout << "The computer Enter the number " << endl;
cout << "Now you guess the number that computer enter" << endl;
compGuess = (rand() % 10) + 1;
// cout<> userGuess;
if (userGuess == compGuess)
{
flag = true;
break;
}
else if ((compGuess - userGuess <= 2 && compGuess - userGuess >= 1) || (compGuess - userGuess >= -2 && compGuess - userGuess <= -1))
{
if (i <= 2)
{
cout << "You are very close to the number:" << endl;
}
}
else
{
if (i <= 2)
{
cout << "You are not close to the number:" << endl;
}
}
}
if (flag == false)
{
cout << "You lose the game!" << endl;
cout << "The number enter by the computer is equal to the " << compGuess << endl;
}
if (flag == true)
{
cout << "You win the game!" << endl;
cout << "The number enter by the computer is equal to the " << compGuess << endl;
}
return 0;
}
If you don't find any problem,in this website and if you have a very difficult assignment question that is not present on internet ,then you dont bother yourself,we are here to solve every problem of your life you just click on the Problem asking button and write your problem we slove the code of your problem and sent you on your email addres that you put in the sin up form.