Please, write code in c++. Using iostream library
A chessboard pattern is a pattern that satisfies the
following conditions:
• The pattern has a rectangular shape.
• The pattern contains only the characters '.' (a dot) and 'X' (an
uppercase letter X).
• No two symbols that are horizontally or vertically adjacent are
the same.
• The symbol in the lower left corner of the pattern is '.' (a
dot).
You are given two numbers. N is a number of rows and
M is a number of columns. Write a program that generates
the chessboard pattern with these dimensions, and outputs
it.
Input
The first line contains two numbers N and M (1 ≤
N ≤ 50, 1 ≤ M ≤ 50) separated by a
whitespace.
Output
Output should contain N lines each containing M
symbols that correspond to the generated pattern. Specifically, the
first character of the last row of the output represents the lower
left corner (see example 1).
example:
input:
8 8
output:
X.X.X.X.
.X.X.X.X
X.X.X.X.
.X.X.X.X
X.X.X.X.
.X.X.X.X
X.X.X.X.
.X.X.X.X
In: Computer Science
Draw Data Flow Diagrams for the following system. Starting with a context diagram, draw as many nested DFDs as you consider necessary to represent all of the details of the system described in the following narrative. Context diagram, Level-0, and Level 1 diagrams are required. You may choose to decompose to level-2, level-3, etc., if you think it’s necessary or if you would like to challenge yourself.
Urban Life Club (ULC) is an innovative young firm that sells memberships to people who have an interest in certain products. People pay membership fees for one year and each month receive a product by mail. For example, ULC has a coffee-of-the-month club that sends members one pound of special coffee each month. ULC currently has five memberships (coffee, wine, beer, flowers, and computer games) each of which costs a different amount. When people join ULC, the customer needs to provide his/her information including the name, mailing address, phone number, e-mail address, credit card information, start date, and membership service(s) (e.g., coffee). The computer game membership operates a bit differently from the others. In this case, the member must also select the type of game (action, arcade, fantasy/ science-fiction, educational, etc.) and age level. Some customers request more products than the membership included (e.g., two pounds of coffee), in which case they will need to pay for the additional costs. ULC is planning to greatly expand the number of memberships it offers (e.g., video games, movies, toys, cheese, fruit, and vegetables) so the system needs to accommodate this future expansion.
In: Computer Science
Please, write code in c++. Using iostream and cstring library
Write a function that will find and return most recent word in
the given text.
The prototype of the function have to be the following void
mostRecent(char *text,char *word)
In char *word your function have to return the most recent word
that occurce in the text.
Your program have to be not case-sensitive(ignore case -
"Can" and "CAN" are the same
words)
Also note than WORD is sequence of letters sepereated by
whitespace.
Note. The program have to use pointer.
Input:
First line contains one line that is not longer than 1000 symbols
with whitespaces.
Output: The most recent word in UPPER case.
example:
Input:
Can you can the can with can?
output:
CAN
In: Computer Science
Write a function treble that takes a pointer to an integer and
triples its value. Note that this function does not return
anything. You can test it using the following example or something
similar:
int i=7;
cout << "old value; i="<<i<< "-"
treble(&i);cout <<"New Value:i="<< i
<<"\n";
Which prints: Old vvalue:i =7 - new value: i=21
In: Computer Science
Pick any simple game that is played on a mobile device or desktop/tablet or game console. For this discussion you should consider the pros and cons of playing the same game using different interfaces. Select two interfaces, other than the GUI and mobile ones (e.g. tangible, wearable, and shareable) and describe how the game could be redesigned for each of these, taking into account the user group being targeted. For example, the tangible game could be designed for young children, the wearable interface for young adults, and the shareable interface for elderly people.
In: Computer Science
Use any C program without using PTHREADS calculate time taken to execute program.
critical section |
|||
mutex solution |
|||
semaphore functions |
|||
Barriers |
|||
Read-Write Locks |
Run program using 1, 2, 4, and 8 threads Comparison study
Number of threads |
||||
Implementation |
1 |
2 |
4 |
8 |
critical section |
||||
mutex solution |
||||
semaphore functions |
||||
Barriers |
||||
Read-Write Locks |
In: Computer Science
Draw a Schema Diagram using the information.
Signum Libri (SL) is a publishing company.
SL Operations Database will keep track of the following:
In: Computer Science
Write a C++ program that involves implementing the RSA cryptosystem. In practice for the encryption to be secure and to handle larger messages you would need to utilize a class for large integers. However, for this assignment you can use built-in types to store integers, e.g., unsigned long long int. Also, rather than using the ASCII table for this assignment use BEARCATII, which restricts the characters to the blank character and the lower-case letters of the alphabet as follows: blank character is assigned the value 0. A, …, Z are assigned the values 1, …, 26, respectively. The message M will be represented by replacing each character in the message with its assigned integer base 27. For example, the message M = “TEST” will be represented as N = 20 5 19 20 Translating this to decimal we obtain: D = 20 + 19*27 + 5*272 + 20*273 = 397838 Note that to convert back to base 27, we simply apply the algorithm we discussed in class, i.e., the least significant digit (rightmost) is obtained by performing the operations D mod 27 and performing a recursive call with D/27. For the example above we obtain, 397838 / 27, 397838 mod 27 = 14734, 20 → 14734 / 27, 14734 mod 27, 20 = 545, 19, 20 → 545/27, 545 mod 20, 19, 20 = 20, 5, 19, 20 = N Find primes p and q by choosing positive integers at random and testing for primality using Miller-Rabin probabilistic algorithm. Your program should prompt the user to input a positive integer representing the public key e. If the user enters a number that is not relatively prime to n = pq, then have the user reenter and keep doing this until e and n are coprime, i.e., gcd(e,φ(n)) = 1. Also prompt the user to enter the message M (as a character string). For handing purposes, run your program with M = “TEST”. Output p, q, n, M, C, P where C is the encrypted message, i.e., cyber text, and P is the decrypted message, i.e., plaintext. If your program is working correctly then M should be equal to P.
In: Computer Science
Laboratory Tasks
public class LinkedList {
Node head;
class Node {
int data;
Node next;
Node(int d) {
data = d;
next = null;
}
}
}
Complete the above java program by adding the following methods:
Part1:
In: Computer Science
Convert this C++ code to Java code
this code is to encrypt and decrypt strings of characters using Caesar cipher
please attach samples run of the code
#include <iostream>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string>
#define MAX_SIZE 200
void encrypt_str(char xyz[], int key); // Function prototype for
the function to encrypt the input string.
void decrypt_str(char xyz[], int key); // Function prototype for
the function to decrypt the encrypted string.
using namespace std;
int main()
{
char input_str[MAX_SIZE];
int shift = 6; // This is the Caesar encryption key... You can
change it to whatever value you wish!
system("cls"); // System call to clear the console screen!
cout<<"\nEnter the string to be encrypted :\t";
gets(input_str); // Getting the user to input the string to be
encrypted!
cout<<"\nOriginal string:\t" << input_str;
// Function call to encrypt the input string
encrypt_str(input_str, shift);
return 0;
}
// Function Definition for the function to encrypt the input
string
void encrypt_str(char xyz[], int key){
char crypted_str[MAX_SIZE]; // To store the resulting string
int k=0; // For indexing purpose
char str;
while(xyz[k] !='\0') // Processing each character of the string
until the "end of line" character is met
{
str = toupper(xyz[k]); // Remove "toupper" from this line if you
don't wish to see the
// result string in Uppercase...
if(str != ' ') str += key;
{
if(str > 'z') str -=26;
{
crypted_str[k] = str;
k++;
}
}
}
crypted_str[k]='\0';
cout << "\nEncrypted string is:\t" << crypted_str; //
Displaying the Crypted String
// Function call to decrypt the encrypted string
decrypt_str(crypted_str, key);
}
// Function Definition for the function to decrypt the encrypted
string.
void decrypt_str(char xyz[], int key){
char decrypted_str[MAX_SIZE];
char str;
int k=0;
while(xyz[k] !='\0')
{
str = xyz[k];
if(str != ' ') str -= key;
{
if(str < 'A' && str !=' ') str += 26;
{
decrypted_str[k] = str;
k++;
}
}
}
decrypted_str[k]='\0';
cout << "\n Decrypted string is:\t" <<
decrypted_str;
}
In: Computer Science
Write a program that performs a merge-sort algorithm without
using a recursion. Only using pointers.
C++ programming language; #include<iostream>
In: Computer Science
3. Public Key Cryptography involves the use of two keys: a public key and a private key. Explain the use of each key
In: Computer Science
Programing language C++
In this exercise you will explore the performance difference between sequential search and binary search. To do so write a program that performs the following tasks:
Prompt the user for a file containing 100,000 unsorted integers
Read those integers into an array
Prompt the user for a search item
Search for that item (using sequential search) and report the number of comparisons required.
Sort the array. Note that this might take a few minutes.
Search for that item again (using binary search) and report the number of comparisons required.
You will need to modify both of the search functions to report the number of comparisons that were made during the search.
Use your program and the file of 100,000 integers provided here to answer the six questions in the quiz.
In: Computer Science
Activity 3: How does injection attack occur? (30 minutes)
Assume the web server includes the following code
sqlString = “select USERID from USER where USERID = ` $userId ` and PWD = ` $password `”
result = GetQueryResult(sqlString)
if(result = “”) then
userHasBeenAuthenticated = False
else
userHasBeenAuthenticated = True
end if
Here, $userId and $password are the values submitted by the user, and the query statement provides the quotation marks that set it as a literal string.
Critical Thinking Question
In: Computer Science
Activity 2: Injection Basics Injection attacks trick an application into including unintended commands in the data send to an interpreter.
Interpreters Interpret strings as commands such as SQL, shell (cmd.exe, bash)
Critical Thinking Questions: 1. What does a user/attacker see at the webpage? Where can an attacker enter exploit data/input? 2. Which entity builds user string input and send SQL query to Database server? 3. Which entity executes query including exploit and send back to web server and then user?
In: Computer Science