تحويل حروف المصفوفة الى حروف كبيرة
2 مشترك
صفحة 1 من اصل 1
تحويل حروف المصفوفة الى حروف كبيرة
حل سؤال تحويل حروف المصفوفة الى حروف كبيرة
- الكود:
#include<iostream>
#include<string>
using namespace std;
void main()
{
int i,w=0;
char a[20];
cin.getline(a,20);
for (i=0;(i<20&&a[i]!=' ');i++)
{
cout<<a[i];
}
for (i=0;i<20;i++)
{
while (a[i]==' ')
{
cout<<"."<<a[i+1];
i++;
}
}
cout<<"\n";
for(i=0;i<20;i++)
{
a[i]=toupper(a[i]);
cout<<a[i];
}
cout<<"\n";
system ("pause");
}
رد: تحويل حروف المصفوفة الى حروف كبيرة
other solution:
- الكود:
#include <iostream>
#define z 30
using namespace std;
int main (){
char namearray[z],x;
int i,s,y;
cout<<"enter your full name: ";
for(i=0;i<z;i++){
cin.get(x);
if(y=islower(x))
x=toupper(x);
if (x!='\n')
namearray[i]=x;
else break;}
for(i=0;i<z;i++)
if(namearray[i]!=' ')
cout<<namearray[i];
else{
cout<<" ";
cout<<char (toupper(namearray[i+1]));
cout<<". ";
i++;break;}
s=i;
for(i=s;i<z;i++){
if(namearray[i]==' '){
cout<<namearray[i+1];
cout<<". ";
break;}}
cout<<endl;
cout<<endl;
system("pause");
}
صفحة 1 من اصل 1
صلاحيات هذا المنتدى:
لاتستطيع الرد على المواضيع في هذا المنتدى
3/7/2011, 11:05 pm من طرف anas mohtaseb
» امتحان الفاينال لمختبر برمجة الحاسوب
26/5/2011, 1:45 pm من طرف Basel Tamimi
» حل سؤال الموظفين والرواتب
22/5/2011, 3:17 pm من طرف Basel Tamimi
» sum program with parameters
22/5/2011, 9:33 am من طرف Basel Tamimi
» مختبر 9
18/5/2011, 5:43 pm من طرف Basel Tamimi
» سلايدات الكتاب للاقسام 4 5 7
6/5/2011, 2:07 pm من طرف Basel Tamimi
» شكرا لكم
4/5/2011, 8:51 pm من طرف anas mohtaseb
» Programming Assignment الحل الثاني
2/5/2011, 7:58 am من طرف Basel Tamimi
» سؤال على ال parallel arrays
1/5/2011, 5:06 am من طرف Basel Tamimi