write a c++ program that print (x,z,T,N) on the form of (*) by usin for loop

OK, and where is the question? More importantly, where is the code you've already tried writing?

To quote Daniweb rules:

Do provide evidence of having done some work yourself if posting questions from school or work assignments

So, what have you done on this so far yourself?

Or perhaps you didn't understand the assignment, which is understandable because it makes no sense whatsoever. Where's the rest of the assignment statement?

Edited 2 Years Ago by Schol-R-LEA

how to create a program that print out all odd integer from 1 up to the number inputted by the user.
SAMPLE PROGRAM:
Input a number:10
Even integers:1,3,5,7,9

please answer using the dev c++

First off, don't hijack other people's threads with unrelated questions; if you have a new question not related to the thread, create a new thread.

Second, didn't you read what I said to oppu.qhar? We don't do other people's homework for them like that. If you want help, show us what you've already done, otherwise, we can't help you and won't even respond to you. If you want the work done for you, hie your lazy self to freelancer.com and pay someone to do it, just don't cry to us when you get caught cheating.

    soooooory I will go out from hear
    #include<iostream>
    #include<iomanip>
    using namespace std;
    int main()
    {

        cout<<"1-(Z)"<<'\n'<<"2-(T)"<<'\n'<<"3-(N)"<<'\n'<<"4-(X)"<<endl;
        cout<<"choos your latter :";
        cin>>p;
        cout<<endl;
        switch(p)
        {
            case 1:
        for(g=1;g<=3;g++)
            cout<<'*';
        for(a=5;a>1;a--)
        {
            if(a!=5)
         cout<<setw(a-1)<<setfill(' ');
            for(b=a;b==a;b--)   
                cout<<'*';
            if(b>1)
             cout<<endl;      
        }
        for(g=1;g<=3;g++)
            cout<<'*';
        cout<<endl;

        break;
            case 2:for(t=1;t<=5;t++)
        cout<<'*';
        cout<<endl;
        for(y=1;y<=4;y++)
        {
            for(a=2;a==2;a++)
                cout<<"  "<<'*';
            cout<<endl;
        }
        break;
            case 3:g=5;
                for(a=5;a>=1;a--)   
        {
            cout<<'*';
                cout<<setw(a-g)<<setfill(' ');
                if(a!=5)
                cout<<'*';
                g=g-2;
                if(a!=1)
                cout<<setw(a-1)<<'*';


                cout<<endl;   
        }
    break;
            case 4:b=1;
                g=5;
                t=4;

        for(a=6;a>=1;a--)   
        {
            if(a>3)
                cout<<setw(a-g)<<setfill(' ');
            else
                cout<<setw(a);
                cout<<'*';
                if(a>3)
                cout<<setw(a-b)<<'*';
                else
                {
                    cout<<setw(t-a)<<'*';
                    t++;
                }
                b++;
                g=g-2;
                cout<<endl;   
        }
            default:cout<<"wrong choise!!!!!"<<endl;
        }

        system ("pause");
        return 0;
    }

Could you exlplain your question first?
I mean what do you want to achieve?

and on a side note-

     for(int g=1; g<=3; g++)  //<-- try using this ( int g)

If you have errors post those too.

It seems you were trying to show a MENU with 4 choices ...

To print a big (graphic) letter,

Choices are: Z or T or N or X

Rather than a switch and case ... sometimes a TABLE is nicer :)

// bigLetters.cpp //


#include <iostream>
#include <string>

#include <cstdlib>

using namespace std;

const char* zz = " ------- \n" \
                 "       / \n" \
                 "      /  \n" \
                 "     /   \n" \
                 "    /    \n" \
                 "   /     \n" \
                 "  /      \n" \
                 " /       \n" \
                 " ------- ";

const char* tt = "---------\n" \
                 "    |    \n" \
                 "    |    \n" \
                 "    |    \n" \
                 "    |    \n" \
                 "    |    \n" \
                 "    |    \n" \
                 "    |    \n" \
                 "    |    ";

const char*  nn = "          \n" \
                 "|\\       |\n" \
                 "| \\      |\n" \
                 "|  \\     |\n" \
                 "|   \\    |\n" \
                 "|    \\   |\n" \
                 "|     \\  |\n" \
                 "|      \\ |\n" \
                 "|       \\|";

const char* xx = "\\       /\n" \
                 " \\     / \n" \
                 "  \\   /  \n" \
                 "   \\ /   \n" \
                 "    /\\    \n" \
                 "   / \\   \n" \
                 "  /   \\  \n" \
                 " /     \\ \n" \
                 "/       \\";


const char* letters [] = { zz, tt, nn, xx };

int main()
{
    for( ; ; )
    {
        cout << "Choose 1-z, 2-t, 3-n, 4-x \n"
             << "Your choice 1..4 :" << flush;
        string line;
        getline( cin, line );

        if( !line.size() || line[0] < '1' || line[0] > '4' )
        {
            cout << "\nInvalid ... try again ...\n";
        }
        else
            cout << "Your choose: \n\n" << letters[ line[0] - '1' ]
                 << endl;

        cout << "\nMore (y/n) ? " << flush;
        getline( cin, line );
        if( line.size() && (line[0] == 'n' || line[0] == 'n') )
            break;

        cout << endl;
    }

    return 0;
}

Edited 2 Years Ago by David W: fixed typo

This article has been dead for over six months. Start a new discussion instead.