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]
4 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]4 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]4 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
Your ___ can provide hardware firewall protection for your home network where it connects to the ISP's network, just as ISP netw
zalisa [80]

Answer:

router.

Explanation:

Router is the main connection for a house network to the Internet, the firewall function is combined to the router. Every house network must have a firewall to protect their privacy.

The router provides the hardware firewall while the windows provides the software firewall.So the answer to this question is router.

5 0
3 years ago
When right-clicking an object, a ____ menu appears, which contains frequently used commands related to the object.
jeyben [28]
When right clicking an object in word, Shortcut menu appears which contains frequently use commands that relate to the object
7 0
2 years ago
2. Write a program that initializes an array of characters with the phrase, "Take me to Clearwater Beach!". Using pointers, scan
navik [9.2K]

Answer:

Written in C++

#include<iostream>

using namespace std;

int main() {

char myword[] = {'T','a','k','e',' ','m','e',' ','t','o',' ','C','l','e','a','r','w','a','t','e','r',' ','B','e','a','c','h','!', '\0'};

for (char *i = myword; *i != '\0'; ++i){

if( *i >= 'a' && *i <= 'z'){

           *i -= 'a' - 'A';    

       }

   }

   cout<<myword;

   return 0;

}

Explanation:

This line initializes the string to a char array

char myword[] = {'T','a','k','e',' ','m','e',' ','t','o',' ','C','l','e','a','r','w','a','t','e','r',' ','B','e','a','c','h','!', '\0'};

This iterates through the char array

for (char *i = myword; *i != '\0'; ++i){

This checks for uppercase or lowercase

if( *i >= 'a' && *i <= 'z'){

This converts to lowercase

           *i -= 'a' - 'A';

       }

   }

This prints the new string in all uppercase

   cout<<myword;

6 0
3 years ago
Computer Applications
abruzzese [7]

Answer:

a b e

Explanation:

3 0
3 years ago
A time line may identify cause or effect of an event?<br> True or False?
levacccp [35]
True whenever you look at one it helps identify the cause/effect of an event
3 0
3 years ago
Other questions:
  • The ____ problem-solving cycle involves inputting code to an assembler, translating it to machine language, loading it into a Vo
    10·1 answer
  • to create an app for a mobile device, yourself, you would use BLANK software like Swift, Corona or Scratch.
    13·1 answer
  • The index number of a combobox object can be assigned to a(n) ____ data type variable
    13·1 answer
  • Establishing responsibilities, planning to best support the organization, acquiring validity, ensuring performance, conformity w
    12·1 answer
  • Andrew wants to create a website for his college. Which web-based programming language should he use?
    11·2 answers
  • Describe a hybird electrical vehical
    12·1 answer
  • Given N lines of input, print the 3rd character from each line as a new line of output. It is guaranteed that each of the n line
    8·1 answer
  • Discuss TWO changes in ICMP that took place with the development of IPV6 and indicate why those changes were made.
    7·1 answer
  • What is your favorite anime?
    11·1 answer
  • While storms could be a cause, power______ are more likely to be caused by disturbances from high-demand equipment in a home or
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!