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
Ilia_Sergeevich [38]
4 years ago
8

Write a function called ordinal_sum that accepts a string argument and returns the sum of the ordinal values of each character i

n the string. The ordinal value of a character is its numeric Unicode code point in decimal.
Computers and Technology
1 answer:
Elena L [17]4 years ago
3 0

A function called ordinal_sum that accepts a string argument and returns the sum of the ordinal values of each character in the string. The ordinal value of a character is its numeric Unicode code point in decimal.

Explanation:

The function is ordinal_sum. The string can be accepted in the variable str " ".

#include <iostream>  

#include <string>  

#include <vector>  

using namespace std;  

 

long long int ordinal_sum (string str,  vector<long long int>& sumArr)  

{  int l = str.length();  

int sum = 0;  

long long int bigSum = 0L;

for (int i = 0; i < l; i++) {

if (str[i] == ' ') {  

 bigSum += sum;  

sumArr.push_back(sum);  

sum = 0;  

       }  

       else

sum +=  str[i];          

   }  

   sumArr.push_back(sum);  

   bigSum += sum;  

   return bigSum;  

}

int main()  

{  

   string str = " "

   vector<long long int> sumArr;  

   long long int sum = ASCIIWordSum(str, sumArr);

   cout << "Sum of ASCII values:" << std::endl;  

   for (auto x : sumArr)  

       cout << x << " ";  

   cout << endl  << "Total sum -> " << sum;  

   return 0;  

}

You might be interested in
Advancing technology has made life easier for people and businesses today. Imagine that you have to work for an entire day witho
Advocard [28]

Answer:

Sí gracias a la tecnología estamos conectados, hay personas de escasos recursos que no tienen dinero suficiente para poder comprar internet y los niños, se quedan sin estudio, por eso las autoridades deben ayudar a las personas de escasos recursos, espero que te ayude mi comentario, Bendiciones.

Explanation:

3 0
3 years ago
Best free vpn to bypass geo tagging
Mamont248 [21]

Answer:

Nord VPN

Explanation:

5 0
4 years ago
Secure Hashing Algorithm (SHA) is an algorithm for generating cryptographically secure one-way hash, published by the National I
vitfil [10]

Answer:

64 bits.

Explanation:

Secure Hash Algorithms (SHA) :- These are a family of cryptographic hash functions. There are basically four types of secure hash algorithms for generating cryptographically secure one-way hash.They are as following:-

SHA-0

SHA-1

SHA-2

SHA-3

SHA -2 consists of SHA-512 and the word size used by it is 64 bits.

3 0
3 years ago
What is similar software engineering, Hardware engineer, Network Architect, and Web developer?
Oliga [24]

I Am Pretty Sure The Answer Is - "B"

Hope This Help's

5 0
3 years ago
Your organization network diagram is shown in the figure below. Your company has the class C address range of 199.11.33.0. You n
user100 [1]

Answer:

aaaa

Explanation:

6 0
3 years ago
Other questions:
  • _____ provide the standards, syntax, statements, and instructions for writing computer software
    14·1 answer
  • Tanya is entering the amount of money she has earned from babysitting onto an Excel spreadsheet, but the AutoComplete feature is
    9·2 answers
  • A __________ is when the sender cryptographically marks a message with its private key, which is achieved by a cryptographic alg
    12·1 answer
  • How are computers used in producing weather forecasts?
    8·1 answer
  • SOMETHING WRONG WHAT WRONG!!!!!!!
    15·2 answers
  • Cuál ha sido el papel de las tecnologías de la información y los medios de comunicación en el fenómeno de la globalización​
    10·1 answer
  • What is a frame injection attack in a wireless network?
    13·2 answers
  • Trong mạng internet, chúng tôi thay đổi công nghệ mạng LAN sang một công nghệ
    5·1 answer
  • 4.(L.5.1.A) Select the sentence that includes an interjection,
    12·1 answer
  • The firewall protects a computer or network from network-based attacks along with _____________ of data packets traversing the n
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!