help on this qn about c++ pragramming.

josby

Member
Sep 8, 2012
85
0
I need a help on how to write c++ codes that will excute/display 20 lines of stars in a pyramid shape. Thanks in Advance.
 

thesym

JF-Expert Member
Aug 15, 2012
3,391
2,000
Programming inahitaji mazoezi. Nikuulize ww umeshajaribu kulifanya na ukakwama sehemu au unataka utafuniwe kila kitu bila kuumiza kichwa?.onyesha sehemu ya code uliyoifanya ndo usaidiwe otherwise google code za namna hiyo zipo kibao.
 

josby

Member
Sep 8, 2012
85
0
Programming inahitaji mazoezi. Nikuulize ww umeshajaribu kulifanya na ukakwama sehemu au unataka utafuniwe kila kitu bila kuumiza kichwa?.onyesha sehemu ya code uliyoifanya ndo usaidiwe otherwise google code za namna hiyo zipo kibao.

Nimeshajaribu ndugu,nahitaji na msahada wa wadau naweza pata njia rahisi zaidi,na pia hata google nimeshatumia,lakin katka kusoma napenda kukusanya mawazo sehem mbali mbali.
 

elmagnifico

JF-Expert Member
Jul 7, 2011
8,075
2,000
Mimi siyo mtabe wa programming lakini ningefanya hivi though najua wapo watabe wangefanya kwa kutumia njia rahisi zaidi
Code:
#include <iostream>

int main()
{

            std::cout<<"                   *          \n";
            std::cout<<"                  ***          \n";
            std::cout<<"                 *****          \n";
            std::cout<<"                *******          \n";
            std::cout<<"               *********          \n";
            std::cout<<"              ***********          \n";
            std::cout<<"             *************          \n";
            std::cout<<"            ***************          \n";
            std::cout<<"           *****************          \n";
            std::cout<<"          *******************          \n";
            std::cout<<"         *********************          \n";
            std::cout<<"        ***********************          \n";
            std::cout<<"       *************************          \n";
            std::cout<<"      ***************************          \n";
            std::cout<<"     *****************************          \n";
            std::cout<<"    *******************************          \n";
            std::cout<<"   *********************************          \n";
            std::cout<<"  ***********************************          \n";
            std::cout<<" *************************************          \n";
            std::cout<<"***************************************          \n";

return 0;
}
 

elmagnifico

JF-Expert Member
Jul 7, 2011
8,075
2,000
Au waweza tumia hii kama ukiona yafaa

Code:
#include <iostream>



int main()
{
    int left=20;
    int right=16;
    for(int i=0; i<21; i++)
    {
        for(int j=0; j<40; j++)
        {

            if (j>=left && j<=right)
            {
                std::cout << "*" ;
            }
            else if(j>right)
            {
                std::cout <<"  ";
            }
            else
                std::cout << " ";
        }
        left--;
        right++;
        std::cout << std::endl;
    }
    return 0;
}
 

NullPointer

JF-Expert Member
Feb 7, 2011
3,467
2,000
Mkuu sio unabeba unaenda kupeleka darasani kama assignment, ukifanya hvo mwisho wa siku programming utaambulia zero, unajifunza programming na unaonyesha ni beginner kabisa, kwa nini usitumie video lecture za Harvard CS50 ambayo ni full inteoduction to progamming ikupe angalau ile akili ya kufikiria kama programmer matatizo kama haya hutoyaumizia kichwa kabisa, n ukiimaliza ile course utaweza kudesign program nyepec nyepec hata webpages tricks nyingi
 

josby

Member
Sep 8, 2012
85
0
Mkuu sio unabeba unaenda kupeleka darasani kama assignment, ukifanya hvo mwisho wa siku programming utaambulia zero, unajifunza programming na unaonyesha ni beginner kabisa, kwa nini usitumie video lecture za Harvard CS50 ambayo ni full inteoduction to progamming ikupe angalau ile akili ya kufikiria kama programmer matatizo kama haya hutoyaumizia kichwa kabisa, n ukiimaliza ile course utaweza kudesign program nyepec nyepec hata webpages tricks nyingi

1.Hio sio assignment
2.Najifunza kwa njia nyingi,sio hizo vdeo tu,hata ninavyoweka hapa nategemea kupata solutions nyingi tofauti,ambazo nikizipitia nazidi kupata uwezo mkubwa wa kufikiri na kujua mambo mengine. Kujifunza ni kuchukua mawazo sehem mbalimbali.
 

Stefano Mtangoo

Verified Member
Oct 25, 2012
4,366
2,000
elmagnifico
that was nice one!
Code:
                  *                                          
                 ***                                        
                *****                                      
               *******                                    
              *********                                  
             ***********                                
            *************                              
           ***************                            
          *****************                          
         *******************                        
        *********************                      
       ***********************                    
      *************************                  
     ***************************                
    *****************************              
   *******************************            
  *********************************          
 ***********************************        
*************************************
 
Last edited by a moderator:

josby

Member
Sep 8, 2012
85
0
Wakuu nimekutana na lingine,mwenye idea please.
Car passing at bridge tollbooth should pay 500. Mostly they do but sometimes a car goes by without paying. Model this tollbooth with class called toolbooth, the two data items are of tye integer total number of cars,and a type of of double total amount collected. A constructor initialize both of the items ti zero,a member function called payingcar() increases the car total and add 500 to the cash total. Another function called nonpayingcar() increment the total but nothing to the total cash, finally a member function called display() to display the two total. Include a program to test this class.
 

Toa taarifa ya maudhui yasiyofaa!

Kuna taarifa umeiona humu JamiiForums na haifai kubaki mtandaoni?
Fanya hivi...

Umesahau Password au akaunti yako?

Unapata ugumu kuikumbuka akaunti yako? Unakwama kuanzisha akaunti?
Contact us

Similar Discussions

Top Bottom