الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

[مخالف]ارجوكم

مغلق
بدأه ام خالد3 في 12 مارس 2010 · 1 رد · 211 مشاهدة · في ارشيف قسم C/C++
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Q. write a program that reads in a sentence of up to 100 characters and outputs the sentence with spacing corrected and with letters corrected for capitalization. In other words, in the output sentence, all string of two or more blanks should be compressed to a single blank. The sentence should start with an uppercase letter but should contain no other uppercase letters. Don’t worry about proper names, if there first letter are changed to lowercase, that is acceptable. Treat a line break as if it was a blank, in the sense that line break and any number are blanks are compress to a single blank. Assume that the sentence ends with a period and contains no other period. For example the input

the Answer to life, the universe, and everything

IS 42.

Should produce

The answer to life, the universe, and everything is 42.

i should use this two function

str.insert(pos, str2)

str.erase(pos, length)

حاول احل بس ما اعرف استخدم الfunction فبليز ساعدوني وذا في اخطاء اخرى بليز عدلوها

#include<iostream>

#include<string>

#include<cctype>

int main()

{

char s1[100];

getline.cin(s1,100);

int i=0;

while(s1!='.')

{

if(s1[0] != ' ')

s1[0] = toupper(s1[0]);

for (int i = 0; i < 100 ; i++)

{

if(s1 == ' ')

if( s1[i+1]==' ')

{s1.insert(i, s1)

s1.erase(i,100-i)

} }

i++;

}

cout<<s1<<endl;

return 0;

}

#2

الأخ الكريم/الأخت الكريمة

السلام عليكم ورحمة الله وبركاته

مرحباً بكم في منتدى الفريق العربي للبرمجة

تأسف إدارة المنتدى لغلق الموضوع وذلك لمخالفته قوانين المشاركات .

قواعد طرح المشاركات

/index.php?showtopic=29343

شاكرين لكم حُسن تعاونكم

مدونتي: C++ Tips and Tricks

هذا الموضوع مغلق.

مواضيع مشابهة