الســــــــلام عليكم
أسعــــــد الله أوقاتكم بكل خير وأنس..,
هذا سؤالين حليتهم ومو متاكـــــــده ويطلع عندي اخطاء بالكود.. وهذي محاولتي
اقتباسWrite C++ program that uses a do …..while loop to compute and prints the sum of given number of squares .For example , if 5 input , then the program will print 55 , which equals :12+22+32+42+25<<<< كلها أس 2
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int num,f=0;
do
{ cout<<"enter the number";
cin>>num;}
while(num>=1);
{
f=(int num,2)+f;
num--;
}
cout<<f;
return 0;
}وهذا السؤال الثاني..
اقتباسwrite a program that reads form the user 20 characters and pass them to function Vowel the counter and returns the number of vowels letter {a,e,I,u,o}.For example ,q,w,e,d,r,g,a,I,o.
There are 4 vowels letter.
وهذه محاااااااااولتي..
#include<iostream>
using namespace std;
char c;
void vowel()
{
int conta=0;
int conte=0;
int conti=0;
int contu=0;
int conto=0;
cout<<"enter the 20 characters";
cin>>c;
switch (c)
{
case'a':
case'A':
conta++;
break;
case'e':
case'E':
conte++;
break;
case'i':
case'I':
conti++;
break;
case'u':
case'U':
contu++;
break;
case'o':
case'O':
conto++;
break;
default:
cout<<c;
}
int main()
{
vowel();
int conter;
conter=conta+conte+conti+contu+conto;
cout<<"\nThere are"<<conter<<"vowels letter";
return 0;
}