computer science

posted by .

The variable cp_arr has been declared as an array of 26 pointers to char. Allocate 26 character values, initialized to the letters 'A' through 'Z' and assign their pointers to the elements of cp_arr (in that order).

  • computer science -

    Can you post your code and explain the difficulties you encounter?

  • computer science -

    lol I've had so many codes for this problem.

    int *arr1[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
    arr1=cp_arr[0];
    for(int i = 0; i < 26; i++)
    cout << cp_arr[i];
    is the newest,
    char a ='A', b = 'B', c = 'C', d='D', e='E', f='F', g='G', h='H', i='I', j='J', k='K',l='L', m='M', n='N', o='O', p='P', q='Q', r='R', s='S', t='T', u='U', v='V', w='W', x = 'X', y='Y', z='Z';
    cp_arr[0] = a;
    cp_arr[1] = b;
    cp_arr[2] = c;
    cp_arr[3] = d;
    cp_arr[4] = e;
    cp_arr[5] = f;
    cp_arr[6] = g;
    cp_arr[7] = h;
    cp_arr[8] = i;
    cp_arr[9] = j;
    cp_arr[10] = k;
    cp_arr[11] = l;
    cp_arr[12] = m;
    cp_arr[13] = n;
    cp_arr[14] = o;
    cp_arr[15] = p;
    cp_arr[16] = q;
    cp_arr[17] = r;
    cp_arr[18] = s;
    cp_arr[19] = t;
    cp_arr[20] = u;
    cp_arr[21] = v;
    cp_arr[22] = w;
    cp_arr[23] = x;
    cp_arr[24] = y;
    cp_arr[25] = z;

    for(int i = 0; i < 26; i++)
    cout << cp_arr[i];
    cout << endl;
    both worked in visual but not myprogramming lab there has to be a better code for this but these were the only ones that worked

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. science C++ programing

    could you please help me with this program even with one part please: Adding two strings (Actually, the correct term is concatenate because unlike adding two number and getting a new result, we add a second string to the end of the …
  2. Programming

    Here is the source code for the Kitty class: public class Kitty { String name; int age; public Kitty(){ } public void setName(String n){ name = n; } public String getName(){ return name; } public void setAge(int a){ age = a; } public …
  3. computer science C++

    The variables arr1 and arr2 have been declared as pointers to integers. An array of 10 elements has been allocated, its pointer assigned to arr1, and the elements initialized to some values. Allocate an array of 20 elements, assign …
  4. computer science

    The variable cp_arr has been declared as an array of 26 pointers to char. Allocate 26 character values, initialized to the letters 'A' through 'Z' and assign their pointers to the elements of cp_arr (in that order). int *arr1[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; …
  5. computer science

    Declare a structure whose tag name is Emp and that contains these fields (in the following order): a double field named d, a character pointer named str, and an array of eleven integers named arr. * I'm good till here. In addition, …
  6. computer science

    my code works in c++ so the logical I am getting error must be in the reading of the problem, but I can't see it: Given a type Money that is a structured type with two int fields, dollars and cents. Assume that an array named monthlySales …
  7. computer science

    Assume that BlogComment is a structured type with these fields, comment (a string, the actual comment), and two int fields: like, dislike which count the number of "likes" and "dislikes" of the comment by visitors. Assume that nComments …
  8. C++

    The variables arr1 and arr2 have been declared as pointers to integers . An array of 10 elements has been allocated, its pointer assigned to arr1, and the elements initialized to some values . Allocate an array of 20 elements , assign …
  9. C++

    (4 points) Identify the errors in the following statements. int* p = &44; - i think the star is the error because pointers are supposed to be like *p?
  10. Algebra

    A basketball player makes 53 points on 24 shots. How many 3 pointers and 2 pointers did he shoot. Show your work. I know that the answer is 5 for the 3 pointers and 19 2 pointers but I don't know how to show it.

More Similar Questions