I have to provide an explantion as to why the output is what it is. why is it when i compile this bit of code i get a count going from 0 to 25. also why does it not display any letters if im using char.
for (int n-0; n<26;n++){
cout <<<char (n+97)-'a'<<endl;
}
The code must be as:
for (int n=0; n<26;n++){
cout <<char (n+97)-'a'<<endl;
}
Otherwise, it is giving compilation errors.
97 is ascii code of 'a'
n goes from 0 to 25
n+97 will goes from 97 to 122 . Thus ascii value of a to z
char(0+97) => 'a'
char(0+97)-'a' = 0
Thus loop will print 0 to 25.
It will print char if whole expression is typecased to character.not the given code.
I have to provide an explantion as to why the output is what it is. why...
i need help determining the output for these problems For ( int count = 1; count < 30; count+=9) Cout << (3 + count) << “ “ ; ________________ int I = 1; While ( I <= 10) { If ( I > 5 && i ! = 9) Cout << ‘x’ ; I++; } ____________________ double a [3] = {1.1, 2.2, 3.3}; cout << a [0] << “ “ << a...
What is the output?
Can someone provide detailed comments on what this code is doing for each line? I posted the assignment below. I am having trouble learning and getting assistance because I keep getting answers provided w/ good information on how the problem was solved. I have spent too much on tutoring this month and I am relying heavily on assistance here. Can you please assist with helping me understand each line of code that was written here? Also- is there an easier...
I am having trouble figuring out what should go in the place of "number" to make the loop stop as soon as they enter the value they put in for the "count" input. I am also having trouble nesting a do while loop into the original while loop (if that is even what I am supposed to do to get the program to keep going if the user wants to enter more numbers???) I have inserted the question below, as...
I don't know how to terminate the code in the second time that whether or not the users want to continue to get a new number. PLEASE HELP. To make telephone numbers easier to remember, some companies use letters to show their telephone number. For example, using letters, the telephone number 438-5626 can be shown as GET LOAN. In some cases, to make a telephone number meaningful, companies might use more than seven letters. For example, 225-5466 can be displayed...
What is the output of the following code:for(int i = 1; i < 5; i++) { cout << i << " "; for(int j = 1; j <= i; j++) { cout << j << " "; } cout << endl; } Write C++ code that will store the input “John” in a character array. Make sure to use an array initializer. //CODE int g(int a, int b); void g(int a, int b); True or False? Function g above...
so i have my c++ code and ive been working on this for hours
but i cant get it to run im not allowed to use arrays. im not sure
how to fix it thank you for the help
our job is to write a menu driven program that can convert to display Morse Code ere is the menu the program should display Menu Alphabet Initials N-Numbers - Punctuations S = User Sentence Q- Quit Enter command the user chooses...
Subject: Object Oriented Programming (OOP)
Please kindly solve the above two questions as soon as possible
would be really grateful to a quick solution. would give a thumbs
up.
Thank you!
Q3: Question # 3 [20] Will the following code compile? If it does not, state the errors. If it does compile, write the output. //Function.cpp #include <iostream> using namespace std; void printData (long i) cout<<"In long print Data "«<i<<endl; } void printData(int i) cout<<"In int printData "<<i<<endl; ) void...
What is the output of the program segment? Assume there are no syntax errors and the code will compile. int i = 1; int n = 0; do { cout << i; i++; } while (i <= n); b) What are the values of i and n after execution? Assume there are no syntax errors and the code will compile. int i = 1; int n = 0; do { cout << i; i++; } while (i <= n);
C++ problem where should I do overflow part? in this code do not write a new code for me please /////////////////// // this program read two number from the user // and display the sum of the number #include <iostream> #include <string> using namespace std; const int MAX_DIGITS = 10; //10 digits void input_number(char num[MAX_DIGITS]); void output_number(char num[MAX_DIGITS]); void add(char num1[MAX_DIGITS], char num2[MAX_DIGITS], char result[MAX_DIGITS], int &base); int main() { // declare the array = {'0'} char num1[MAX_DIGITS] ={'0'}; char...