C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 10th, 2012, 09:21 AM
loldafuq loldafuq is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 loldafuq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 11 sec
Reputation Power: 0
General - Help for beginner

Sorry my English is bad.Im beginner in programing with c/c++ I have to write 2 codes and want some help


1.
Write a program with a function main () and selecting a menu of functions:
Generate a programming-random number generator data for lottery ticket / max 100 / with six-digit numbers and store them in an array
-Overwrite generated a new array and sort this array in ascending order and display output
-Counting and display output and numbers of all "happy" six digit lottery tickets /these numbers which sum of the first 3 digits is equal to the last three/
-Save in the array and display output sequence numbers of downloaded "lucky" lottery tickets


I know only rand and srand but how to display these lucky/happy numbers?

2.
Compile program functions for:
-Enter of a keyboard and a file into an array (by adding) data to 30 girls in the competition "Miss World"
number, name, surname, date of birth, physical data, state and display the current contents of the array on the screen
-display output data for a girl by entered from the keyboard a number and surname / by request
a new report /
-Displays data for the youngest girl in the competition and the number of girls under the age of 20 years
function main () menu selection functions and check the status of the data using the Global
variables or functions with transmission parameters, optional


I have a code but its wrong maybe and not completed I dont know how to display youngest girl and data for 1 girl also dont know how to work with files

Code:
#include <stdio>
#include <conio>
#include <cstdlib>
#include <string>
#include <iostream>
using namespace std;
#define N 30 //max girls
typedef struct
{
   char number[10];
   char name[10];
   char family[10];
   int age;
   float heigth;
   float weight;
   char country[3];
} girl;
girl d[N];
int top=0;
float height;
float weight;
void load();
void save();
void input()
{
   int i, n;
   do
   {
       cout<<"\n Whats the number of girls?: ";
       cin>>n;
   }
   while (n<1||n>N);
   fflush(stdin);
   for(i=top;i<n;i++)
   {
       cout<<"\n Number: ";
       cin>>d[i].number;
       cout<<"\n Name: ";
       cin>>d[i].name;
       cout<<"\n Familiy: ";
       cin>>d[i].family;
       cout<<"\n Age: ";
       cin>>d[i].age;
       cout<<"\n Height: ";
       cin>>d[i].height;
       cout<<"\n weight: ";
       cin>>d[i].weight;
       cout<<"\n country: ";
       cin>>d[i].country;
   }
   top+=n;
}
void disp(int i) //Display data for 1 girl
{
   cout<<"\n "<<d[i].nomer<<"\t"<<d[i].ime<<"\t"<<d[i].family<<"\t"<<d[i].age<<"\t"<<d[i].visochina<<"\t"
       <<d[i].teglo<<"\t"<<d[i].country<<endl;
}
void list() //List of girls
{
   int i;
   cout<<"\n List of Girls\n";
   for(i=0;i<top;i++)
   disp(i);
}
void teen()
{
   int i;
   cout<<"\n Girls under 20\n";
   for(i=0;i<top;i++)
   {
       d[i].age*=1;
       if(d[i].age<20)
           disp(i);
   }
}
void load() //file
{
   FILE *fp;
}
int menu()
{
   int ch;
   cout<<"\n_______________MENU_____________________";
   cout<<"\n 1. Input number of girls";
   cout<<"\n 2. Display list of all girls";
   cout<<"\n 3. Display girls under 20";
   cout<<"\n 4. Exit";
   do
   {
       cout<<"\n Choice: ";
       cin>>ch;
   }
   while(ch<1||ch>4);
       return(ch);
}
int main()
{
   int i;
   cout<<"\n Loading file\n";
   load();
   do
   {
       i=menu();
       switch(i)
       {
       case 1: input();break;
       case 2: list();break;
       case 3: teen();break;
       }
   }
           while(i!=4);
return 0;
}

And 2 codes msut be console applications and not object-oriented

Reply With Quote
  #2  
Old November 12th, 2012, 12:26 AM
keekerriy keekerriy is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 6 keekerriy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 56 sec
Reputation Power: 0
I would be a little suspect of a conclusion based on only one study and not confirmed by other research.




Reply With Quote
  #3  
Old November 12th, 2012, 03:06 AM
ericagodwin ericagodwin is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 4 ericagodwin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 24 sec
Reputation Power: 0
looks good,thank you..URLURLURLURL

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > General - Help for beginner


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap