hentjanson
Member
سلام به همه
چطور ميشه از طريق توابع طول يك رشته را كه از ورودي گرفتيم بدست بياريم
من اين برنامه را اينطور نوشتم ميشه راهنماييم كنيد
چطور ميشه از طريق توابع طول يك رشته را كه از ورودي گرفتيم بدست بياريم
من اين برنامه را اينطور نوشتم ميشه راهنماييم كنيد
کد:
[SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#800000]"stdafx.h"
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#800000]<iostream>
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#800000]<conio.h>
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]namespace[/COLOR][/SIZE][SIZE=2] std;
[/SIZE][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] main()
{
[/SIZE][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] c=-1;
[/SIZE][SIZE=2][COLOR=#0000ff]char[/COLOR][/SIZE][SIZE=2] ch;
cout<<[/SIZE][SIZE=2][COLOR=#800000]"Enter your text"[/COLOR][/SIZE][SIZE=2]<<endl;
[/SIZE][SIZE=2][COLOR=#0000ff]do
[/COLOR][/SIZE][SIZE=2]{
ch=getche();
c++;
}[/SIZE][SIZE=2][COLOR=#0000ff]while[/COLOR][/SIZE][SIZE=2](ch!=13);
cout<<[/SIZE][SIZE=2][COLOR=#800000]"Number of characters:"[/COLOR][/SIZE][SIZE=2]<<endl<<c;
getch();
[/SIZE][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][SIZE=2] 0;
}
[/SIZE]