1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
natali 33 [55]
3 years ago
15

Write the following program in C++ to print:

Computers and Technology
1 answer:
Alenkinab [10]3 years ago
4 0
1.
#include <iostream>#include <string>
using namespace std;
int main(){    string chars; // This is where we will put our @ signs and print them    for(int x=0;x < 5; x++){
        chars = chars + '@'; // This will concatenate an @ sign at the end of the variable        cout << chars << "\n";    }}

2.
#include <iostream>#include <string>
using namespace std;
int main(){    string name; // Our variable to store the name    cout << "What is your name? \n"; // Asks the user for their name    cin >> name;    cout << "\nWell, hello " << name << "!";}

3.
#include <iostream>#include <string>
using namespace std;
int main(){    int number; // Our variable    cout << "Enter a number\n"; // Asks for a number    cin >> number;    cout << "You entered " << number << "%!";}

4.
#include <iostream>#include <string>
using namespace std;
int main(){    int number; // Our variable    cout << "Enter a number\n";    cin >> number;
    int check = number % 2; // The modulo operator (the percent sign) gets the remainder of the quotient    if (check == 0) {        cout << number << " is even!"; // If the remainder is 0 then it prints out "x is even"    } else {        cout << number << " is odd!"; // If the remainder is not 0 then it prints out "x is odd"    }}

5.
#include <iostream>#include <string>
using namespace std;
int main(){    float r; // Our variable    cout << "Enter a radius\n";    cin >> r;    if (r < 0){        cout << "Lol. No."; // If the radius is less than zero print out that message    }    float circumference=2*3.14*r;    float area=r*r*3.14;    cout << "\n\n Circumference of circle: " << circumference;    cout << "\n Area of circle: " << area;}
You might be interested in
Am i in elementary yes no
IgorLugansk [536]

Answer:

no

Explanation:

7 0
2 years ago
What did czarnowski and triantafyllou learn from observing boat propulsion systems?
noname [10]
Czarnowski and Triantafyllou learned that boat propellers are not very efficient, except penguin propulsion systems.
7 0
3 years ago
Select the correct answer.
Pachacha [2.7K]
B) Spreading the news about the incident response plan is not a good idea. If an incident was intentionally caused by a malicious person or group, knowing your response plan gives them information about how to make things worse.
3 0
3 years ago
List three considerations when you choose memory.
liq [111]
1)How many memory cards (how many can you computer hold)
2)Company (some companies run better than others)
3)Amount of memory (xGb)
8 0
3 years ago
Program for bit stuffing...?
Olegator [25]

Answer: Program for bit stuffing in C

#include<stdio.h>

      int main()

    {    

          int i=0,count=0;

          char data[50];

          printf("Enter the Bits: ");

          scanf("%s",data);            //entering the bits ie. 0,1  

          printf("Data Bits Before Bit Stuffing:%s",databits);

          printf("\nData Bits After Bit stuffing :");

          for(i=0; i<strlen(data); i++)

              {

              if(data[i]=='1')

                     count++;

              else

                     count=0;

                printf("%c",data[i]);

             if(count==4)

                {

                          printf("0");

                          count=0;

                 }

             }

    return 0;

 }

Explanation:

bit stuffing is the insertion of non-information bits during transmission of frames between sender and receiver. In the above program we are stuffing 0 bit after 4 consecutive 1's. So to count the number of 1's we have used a count variable. We have used a char array to store the data bits . We use a for loop to iterate through the data bits to stuff a 0 after 4 consecutive 1's.

4 0
3 years ago
Other questions:
  • A network administrator is implementing dhcpv6 for the company. the administrator configures a router to send ra messages with m
    6·1 answer
  • A _____ is an electronic path over which data can travel.
    15·1 answer
  • What may happen if a large number of computer users are attempting to access a web site at the same time that you are
    9·2 answers
  • Trish has bought a new computer that she plans to start working on after a week. Since Trish has not used computers in the past,
    10·1 answer
  • What does a spam e-mail normally promise you?
    9·1 answer
  • What is the primary limitation of free versions of antivirus applications?
    13·1 answer
  • It is necessary tto save updates often when working in google docs? True or false
    11·2 answers
  • Brain for free 12628397
    14·2 answers
  • How do people decide their ethical behavior
    13·2 answers
  • Because of the abundance of water on planet Earth, hydrogen gas (H2) is a candidate in the search for a replacement for petroleu
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!