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
bija089 [108]
3 years ago
8

I'm new to programming and I'm starting with c++, so the first program I want to write should take a string of characters and ou

tput it to the console afterwards, but the execution isn't working, I can't find the issue.
'#include
#include
#include
using namespace std;

int main()
{
short T;
cin >> T;

char *str;
//cin.clear();
cin.sync();
cin.ignore(1000, '\n');

while(cin >> *str++)
;

cin.sync();
cin.ignore(1000, '\n');
while(*str++ != '\0')
cout << *str;

return 0;
}
'
Computers and Technology
2 answers:
olganol [36]3 years ago
7 0
Just reading and writing a string should be as easy as:

string msg;
getline(cin, msg);
cout << "Hello " << msg;
return 0;
Amanda [17]3 years ago
5 0
#include <iostream>
#include <string>

using namespace std;

int main() {

string userInput;
cout << "Enter word" << endl;

cin >> userInput;

cout << "you entered" << endl;
cout << userInput;

return 0;

}
You might be interested in
Being nice take the points​
MArishka [77]

Answer:

Sure!!! and thank you very much

4 0
3 years ago
Use the drop-down menus to complete statements about back-up data files.
vlada-n [284]

Answer:

the third one trust me

Explanation:

5 0
3 years ago
Read 2 more answers
The computer that has been traditionally found on the desks in many offices and homes is the ___ computer.
Sladkaya [172]

Answer:

<u> Personal</u> computer

Explanation:

I.d.k the answer so don't blame me if its incorrect

7 0
3 years ago
Explain what an IM is, and what is the technology shown in the accompanying figure
sergiy2304 [10]

Answer: Instant Message

Explanation:

7 0
3 years ago
Read 2 more answers
Write a Python function that takes as input parameters base_cost (a float) and customer_type and prints a message with informati
PSYCHO15rus [73]

Answer:

Explanation:

Thanks for the question, here is the code in python

The 3rd example given in question is incorrect

inputs: check_amount = 26.99, customer_type = "generous" --> output: Total owed by stingy customer = $16.83 (with $1.53 tip)

the customer type in the above passed is generous but why the output is showing for stingy, I think this is incorrect

Here is the function, I have given explanatory names so that you can follow the code precisely and also used pretty formatting.

thank you !

===================================================================

def print_tip(base_cost, customer_type):

   TAX_PERCENTAGE = 1.07

   STINGY_PERCENTAGE = 0.1

   REGULAR_PERCENTAGE = 0.15

   GENEROUS_PERCENTAGE = 0.20

   check_amount = base_cost * TAX_PERCENTAGE

   tip_amount = 0.0

   if customer_type == 'regular':

       tip_amount = check_amount * REGULAR_PERCENTAGE

   elif customer_type == 'generous':

       tip_amount = check_amount * GENEROUS_PERCENTAGE

   elif customer_type == 'stingy':

       tip_amount = base_cost * STINGY_PERCENTAGE

   total_amount = tip_amount + check_amount

   print('Total owed by {} customer = ${} (with ${} tip)'.format(customer_type, '%.2f' % total_amount,'%.2f' % tip_amount))

print_tip(20, 'regular')

print_tip(26.99, 'generous')

print_tip(14.99, 'stingy')

8 0
3 years ago
Other questions:
  • Lindsay owns a candy store that typically makes all if its sales to tourists visiting a nearby zoo. Why might she decide to set
    14·2 answers
  • When can designers use rapid application development? HELP ASAP
    13·1 answer
  • If a programming language does not use short-circuit evaluation, what is the output of the following code fragment if the value
    8·1 answer
  • How do careers of firefighters and police officer death fire in what ways are they similar​
    6·1 answer
  • Want summmmmmmm bec i do lol
    9·1 answer
  • In object-oriented programming, the object encapsulates both the data and the functions that operate on the data.
    10·1 answer
  • A server can be added to Server Manager by which of the following methods?
    9·1 answer
  • Universal Containers uses a custom object within the product development team. Product development, executives, and System Admin
    11·1 answer
  • 17.8.1: Writing a recursive math function. Write code to complete raise_to_power(). Note: This example is for practicing recursi
    10·1 answer
  • Components of document merging?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!