Jump to content
Sign in to follow this  
ldd.man25

Siruri de caractere (ajutor urgent)

Recommended Posts

Am lipsit la scoala o zi si in ziua aia s-a gasit animala sa predea siruri de caractere, a doua zi a continuat sa predea si oricum nu am inteles mare lucru. 

Stiu cu ce se mananca asa dar am nevoie de niste linkuri cu tutoriale concrete ca pentru prosti, deja a inceput sa dea nebuna exercitii ca   

"se considera urmatoarele date de intrare: un caracter c si un sir de caractere, scrie un program care afiseaza nr de aparitii a caracterului c in sir"

a predat niste functii din astea ca "strch" "strstr" , dar nu am apucat sa notez ce mama dreacu fac. Sunt din #include<fstring.h> sau ceva. 

Thx for reading. 

Share this post


Link to post
Share on other sites

Este neaparat cu acele biblioteci?

Nu stiu sigur daca o sa mearga dar uite

 Faci urmatoarele variabile:

char n,sir,i,nr=0;

Parcurgi fiecare caracter din sir cu un while I si dupa urmeaza if-ul:

if ( n==i ) nr++;

cout<<nr;

 


Reborn.

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...