[Show all top banners]

MustaineKoFAN
Replies to this thread:

More by MustaineKoFAN
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 C Prog help
[VIEWED 3825 TIMES]
SAVE! for ease of future access.
Posted on 12-17-08 8:39 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Hey Techguy Bro,
Thnx for the post. Can you do me one more of a favor? I need this done man and I have no idea what C is all about..
1. What does the following code display?

int arr[4], i;
for (i=0; i<4; ++i)
    arr[i]=i+3;
cout<<endl;
for (i=0; i<4; ++i)
   cout<<setw(4) << arr[i];

cout<<endl;
for ( i=3; i >=0; --i)
    cout<<setw(4)  << arr[i];

2. Write a loop to display only the elements of d_array[10] having an even number subscript starting from zero..
3. Declare a two dimensional array, arr_2d, that contains 15 rows, each of which will store 12 integers

5. declare a string called birth_date that is to hold a date in the form of xx/xx/xx. code statements that prompts the user to enter his/her birth date in the form xx/xx/xx and place birth date into the string birth_date

6. Declare an array of character pointers that is initialized to point to the name of the months of the year..


 
Posted on 12-17-08 9:00 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

very interesting... i am not an expert but "cout" in "c" ... i am little doubtfull. ... may be something called "c plus plus" "c++" ..  but definitely  not c.......

but once again what do i knoe (O:
if i recall correctly....
set(w) does nothing more than aligning the width.. i.e. to the  integer of length
(w)

so ...
based on your initializing you are filling up the array called arr with elements
arr[0]=3
arr[1]=4
arr[2]=5
arr[3]=6

so the first display will show
3 4 5 6 [ with 4 spaces between each one of them]then
6 5 4 3 [ with 4 spaces between each of them ]

actually... (2) is very easy if you think about it...

for (i=0; i<=5; i++)
   cout <<setw(4) << arr[2*i];


i will leave tech_guy to do that rest of the work.. ... this is tiring (O:

===============================
as always
what do i know (O:



 
Posted on 12-17-08 9:10 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Thanks man.. Yea I mean C++..My bad... Where is Tech Guy ?? I gotta buzz him...rite on...thnx dude///

 
Posted on 12-17-08 11:48 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

techguy..where@??
 
Posted on 12-19-08 7:16 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

  ey Techguy Bro,
Thnx for the post. Can you do me one more of a favor? I need this done man and I have no idea what C is all about..
1. What does the following code display?

int arr[4], i;
for (i=0; i<4; ++i)
    arr[i]=i+3;
cout<<endl;
for (i=0; i<4; ++i)
   cout<<setw(4) << arr[i];

cout<<endl;
for ( i=3; i >=0; --i)
    cout<<setw(4)  << arr[i];

2. Write a loop to display only the elements of d_array[10] having an even number subscript starting from zero..
3. Declare a two dimensional array, arr_2d, that contains 15 rows, each of which will store 12 integers

5. declare a string called birth_date that is to hold a date in the form of xx/xx/xx. code statements that prompts the user to enter his/her birth date in the form xx/xx/xx and place birth date into the string birth_date

6. Declare an array of character pointers that is initialized to point to the name of the months of the year..

 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 200 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration
What are your first memories of when Nepal Television Began?
निगुरो थाहा छ ??
ChatSansar.com Naya Nepal Chat
Basnet or Basnyat ??
TPS Re-registration case still pending ..
Sajha has turned into MAGATs nest
NRN card pros and cons?
Do nepalese really need TPS?
कता जादै छ नेपाली समाज ??
Will MAGA really start shooting people?
Democrats are so sure Trump will win
मन भित्र को पत्रै पत्र!
Top 10 Anti-vaxxers Who Got Owned by COVID
I regret not marrying a girl at least for green card. do you think TPS will remain for a long time?
काेराेना सङ्क्रमणबाट बच्न Immunity बढाउन के के खाने ?How to increase immunity against COVID - 19?
TPS Work Permit/How long your took?
Breathe in. Breathe out.
3 most corrupt politicians in the world
Dementia Joe has been selected to become the next President
Nas and The Bokas: Coming to a Night Club near you
Mr. Dipak Gyawali-ji Talk is Cheap. US sends $ 200 million to Nepal every year.
Harvard Nepali Students Association Blame Israel for hamas terrorist attacks
TPS Update : Jajarkot earthquake
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters