1.
#include <iostream>
#include <cstdlib>
#include <fstream>
using namespace std;
int main()
{
ofstream wr;
int i,n;
wr.open("myEvenRandoms.txt");
cout<<"Randomly generated even numbers are written to myEvenRandoms.txt file....."<<endl;
wr<<"Randomly generated even numbers :"<<endl;
for(i=1;i<=1000;i++)
{
n=rand()%20+10;
if(n%2==0)
wr<<n<<" ";
}
wr.close();
}
myEvenRandoms.txt:
Randomly generated even numbers :
24 10 14 28 28 12 14 12 26 14 12 22 12 26 28 16 28 22 24 12 14 18
14 12 28 26 20 12 18 16 10 12 14 18 16 20 20 20 16 18 14 24 26 10
16 26 18 14 16 28 28 12 28 14 20 16 16 14 22 20 22 16 20 26 24 22
20 20 14 16 20 28 18 12 16 16 20 18 10 12 20 14 18 12 20 26 24 10
26 18 18 14 24 28 28 10 18 18 18 20 24 26 10 26 28 14 18 14 12 24
18 10 28 28 10 26 28 28 22 12 28 22 28 20 28 18 26 12 24 22 18 16
12 16 12 14 26 28 12 26 22 22 10 20 18 12 12 18 16 22 22 24 26 18
22 24 22 10 28 26 16 26 16 18 12 24 24 26 16 22 18 22 26 28 16 12
14 26 12 20 16 14 22 14 24 20 16 24 12 18 28 28 12 24 24 14 24 24
22 20 28 20 18 22 12 10 12 14 22 22 22 12 12 16 14 10 10 24 20 20
10 26 20 10 24 14 26 24 28 12 16 28 14 28 14 22 10 10 16 20 20 26
28 14 12 16 24 18 10 12 12 26 14 10 12 26 20 16 10 20 14 18 10 12
10 28 28 10 28 10 14 18 20 10 18 14 10 14 26 22 20 26 26 16 16 26
12 22 26 22 26 12 14 24 24 22 22 18 28 12 24 20 16 24 20 28 24 24
26 26 12 18 10 12 12 14 28 22 26 10 22 28 20 22 22 10 18 20 20 24
10 14 28 22 14 18 22 26 10 24 22 14 22 20 18 14 16 28 20 14 16 20
10 14 12 14 28 22 20 12 28 14 18 14 22 16 28 12 14 10 18 28 20 22
22 22 20 10 18 18 18 12 18 10 28 24 18 16 20 20 10 18 26 16 28 14
18 16 14 28 16 26 14 14 12 12 26 18 22 16 16 14 16 22 26 26 24 24
26 22 26 28 12 20 16 20 20 12 24 26 22 18 12 24 24 26 18 14 18 10
10 28 28 20 14 26 12 18 12 24 10 12 28 18 14 22 28 12 28 20 24 18
28 10 14 20 22 18 12 24 20 14 24 10 20 28 18 22 26 18 20 18 14 28
10 24 18 26 20 28 16 10 26
2.
#include <iostream>
#include <cstdlib>
#include<cstring>
using namespace std;
//function to count vowels in string s
int count_vowel(char s[100])
{
int i=0,count=0;
char c;
for(i=0;i<strlen(s);i++)
{
c=s[i];
if(c=='A'|| c=='E'||c=='I'||c=='O'||c=='U')
count++;
if(c=='a'|| c=='e'||c=='i'||c=='o'||c=='u')
count++;
}
return(count);
}
int main()
{
char s[100];
cout<<"Enter a string:";
cin>>s;
cout<<"Number of vowels in "<<s<<" is: "<<count_vowel(s);
}
output:
Please help with this exercises in c++ language Thanks Lab Activity #5-More Functions/FILES Exercise# Write a...
C++ program by netBeans java language Exercise #2: Write a java program that prompts the user to enter a sentence. The program has to find the print: a. the position of vowels in the sentence. b. the number of vowels in the sentence (A, a, U, u, E, e, 0, o, I, i) c. the number of characters as numbers or special characters (other than English letters a..z, A..Z). Hint: remember to ignore the spaces. Sample input-output: Enter the sentnse:...
C++ Homework: This will be the first in a series of assignments to create a game called Zilch. In this assignment, you will create the basic structure of the program and demonstrate the ability to create programs with multiple files. It should serve as a refresher in the basics of C++ programming, especially in the handling of arrays. The initial assignments only establish a rough outline of the game. We will be adding the rules that make the game more...
can someone help me with this C++ problem write your game() function and 3+ functions that simulate the game of Jeopardy Dice according to the following game mechanics and specifications. Game Mechanics There are two players: the user and the computer, who alternate turns until one of them reaches 80 points or higher. The user is always the first player and starts the game. If any player reaches 80 points or more at the end of their turn, the game...
use C language please Problem 5. (5 points] Use string functions. Write a program that: 1) Ask the user to write two strings. 2) If both strings are equal, print an appropriate message then print out both strings with their length. 3) If the strings are not equal, print an appropriate message then concatenate both strings and print out the length of the concatenating strings. 4) In the main function prints both arrays.
please write me this program in C language Review UW files from the Internet can contain viruses. Unless you need to edit, it's safer to stay in Protected View View View - Word Terme MOHAMMED MUNTHER MOH Enable Editing Task # 3: Consider two integer arrays x and y of same size n with values: Xo, X1, X3,..., Xe1 and yo, yi, ya..... Yn-1 Write a function merge that receives array x and y and their size. It then returns...
in C++ This assignment is to use your knowledge of Chap 1-5 to write a simulation program to estimate the winning chance of the Craps game. Craps is a popular dice game played in casinos. Here is how to play: Roll two dice. Each die has 6 faces representing values 1,2,3,4,5,and 6, respectively. Check the sum of 2 dice. If the sum is 2, 3, or 12 (called craps), you lose; if the sum is 7 or 11 (called natural),...
I need help figuring out how to code this in C++ in Visual Studio. Problem Statement: Open the rule document for the game LCR Rules Dice Game. Develop the code, use commenting to describe your code and practice debugging if you run into errors. Submit source code. Use the document to write rules for the user on how to play the game in a text file. Then, using the information from the resource articles, create a program that will read...
In python language Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows: 1. When the program begins, a random number in the range of 1 and 3 is generated. 1 = Computer has chosen Rock 2 = Computer has chosen Paper 3 = Computer has chosen Scissors (Dont display the computer's choice yet) 2. The user enters his or her choice of “Rock”, “Paper", “Scissors" at...
in c++ please Page 1 of 3 (PRO) Project Assignment Instructions Last Charged: 6/1/2020 Read and follow the directions below carefully and perform the steps in the order listed. You will be solving one program as instructed and turning in your work electronically via an uploaded file within Eagle Online/Canvas and copy & paste the program to the Text Entry box as well. Make sure and check your work prior to uploading the assignment (NOTE: For Steps 1 & 2...
C LANGUAGE!!! The program uses both files and two dimensional arrays. The Problem Statement Business is going well for your friend, who is selling discounts to area clubs and restaurants, which means that business is going well for you! Both of you have decided that you'll advertise on memory mall, which is roughly arranged as a rectangle. There's not enough time before a football game to hand flyers to everyone arranged on the mall. Therefore, you will only be able...