Jump to content
Fórum Script Brasil
  • 0

C++


frankxx

Question

OBS>> Não sei programar nada bem , UHSAUHASUhuashasu queria saber esse erro dado após digitar a frase e dar enter. Eis o código abaixo:

#include <iostream>

#include <string>

using namespace std;

//Variáveis

string frase,palavra;

int tam,qtde,n,posi;

//Início

int main ()

{

n=0;

cout<<" Digite a frase com no minimo um espaço no começo dela e sem pontos ou caracteres alem de A-Z..."<<endl<<endl;

getline(cin,frase);

tam=frase.length();

while (n<=tam) {

if (frase.substr(n,1)==" ") {

posi=n;

while (frase.substr(posi+1,1)!=" "){

qtde++;

posi++;

}

palavra=frase.substr(n,qtde+1);

cout<<endl<<palavra<<" "<<qtde<<" letras"<<endl<<endl;

n=posi;

n++;

qtde=0;

posi=0; }

}

system ("pause");

}

Grato desde já

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...