help on this qn about c++ pragramming.


J

josby

Member
Joined
Sep 8, 2012
Messages
85
Likes
0
Points
0
J

josby

Member
Joined Sep 8, 2012
85 0 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

thesym

JF-Expert Member
Joined
Aug 15, 2012
Messages
3,048
Likes
2,869
Points
280
thesym

thesym

JF-Expert Member
Joined Aug 15, 2012
3,048 2,869 280
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.
 
J

josby

Member
Joined
Sep 8, 2012
Messages
85
Likes
0
Points
0
J

josby

Member
Joined Sep 8, 2012
85 0 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

elmagnifico

JF-Expert Member
Joined
Jul 7, 2011
Messages
7,894
Likes
7,629
Points
280
Age
30
elmagnifico

elmagnifico

JF-Expert Member
Joined Jul 7, 2011
7,894 7,629 280
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

elmagnifico

JF-Expert Member
Joined
Jul 7, 2011
Messages
7,894
Likes
7,629
Points
280
Age
30
elmagnifico

elmagnifico

JF-Expert Member
Joined Jul 7, 2011
7,894 7,629 280
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

NullPointer

JF-Expert Member
Joined
Feb 7, 2011
Messages
3,480
Likes
722
Points
280
NullPointer

NullPointer

JF-Expert Member
Joined Feb 7, 2011
3,480 722 280
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
 
J

josby

Member
Joined
Sep 8, 2012
Messages
85
Likes
0
Points
0
J

josby

Member
Joined Sep 8, 2012
85 0 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

Stefano Mtangoo

Verified Member
Joined
Oct 25, 2012
Messages
3,689
Likes
908
Points
280
Stefano Mtangoo

Stefano Mtangoo

Verified Member
Joined Oct 25, 2012
3,689 908 280
elmagnifico
that was nice one!
Code:
                  *                                          
                 ***                                        
                *****                                      
               *******                                    
              *********                                  
             ***********                                
            *************                              
           ***************                            
          *****************                          
         *******************                        
        *********************                      
       ***********************                    
      *************************                  
     ***************************                
    *****************************              
   *******************************            
  *********************************          
 ***********************************        
*************************************
 
Last edited by a moderator:
J

josby

Member
Joined
Sep 8, 2012
Messages
85
Likes
0
Points
0
J

josby

Member
Joined Sep 8, 2012
85 0 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.
 

Forum statistics

Threads 1,251,865
Members 481,917
Posts 29,788,241