Pular para o conteúdo principal

Postagens

Mostrando postagens com o rótulo STRCPY

C, strcpy, char, repeat, because I'm happy, sring.h

#include #include int main() {     system("color 1f");     char message[10];     int count,i;     strcpy(message,"because I'm Happy!!");     printf("Repeat how many times?");     scanf("%d",&count);     for(i=0;i     printf("%3d-%s\n",i,message);     system("pause"); }

C++, abrevia vetor de char, strcpy

//protecaoVetorDeChar.cpp #include #include #define TAM 3 using namespace std; int main() { char nome[TAM][11], csv[100]; int x; for(x=0; x { cout<<"\nNome: "; cin.getline(csv, 100); while(strlen(csv)> 10) { cout<<"\nNome com no maximo 10 caracteres. Abrevie."; cout<<"\nNome: "; cin.getline(csv, 100); } strcpy(nome[x], csv); } system("cls"); cout<<"\nRelacao dos Nomes\n"; for(x=0; x cout<<"\n"< cout<<"\n\n"; system("pause"); } Abrevia vetor download.

C++ SRTCAT, DEFINE,STRCPY

//strcat.cpp #include #include #define TAM 3 using namespace std; int main() { char nome[TAM][31], lixo[100]; int x,idade[TAM]; for(x=0; x { cout<<"\nNome: "; cin.getline(lixo, 100); while(strlen(lixo)> 30) { cout<<"\nNome com no maximo 30 caracteres. Abrevie."; cout<<"\nNome: "; cin.getline(lixo, 100); } strcpy(nome[x], lixo); //Atencao para esse trecho while(strlen(nome[x]) < 30) strcat(nome[x], " "); cout<<"\nIdade: "; cin>>idade[x]; cin.get(); } system("cls"); cout<<"\nNome\t\t\t\tIdade\n"; for(x=0; x cout<<"\n"< cout<<"\n\n"; system("pause"); }