Author Topic: C++ programming  (Read 4216 times)

Offline Ahmed

  • TATW & LATW
  • ***
  • Posts: 320
  • Reputation: 566
    • View Profile
Re: C++ programming
« Reply #12 on: Mar 16, 2009, 04:15: AM »
C++ is the best/most powerful language , even JAVA is made in C++ . C++ is best for concepts and the most difficult language because it covers almost every part of the programming stuff from gaming to graphics to pure coding . Learn all the concepts in C++ then move to C# , you will love that language too  :thumbsup:
« Last Edit: Mar 16, 2009, 12:57: PM by Ahmed »

Offline DanTheMan

  • Freestyle Moderator
  • APATW & PMATW
  • ****
  • Posts: 3,510
  • Reputation: 4870
    • View Profile
Re: C++ programming
« Reply #13 on: Mar 16, 2009, 10:09: AM »
C++ is the best/most powerful language , even JAVA is made in C++ . C++ is best for concepts and the most difficult language because it covers almost every part of the programming stuff from gaming to graphics to pure coding . Learn all the concepts in C++ then move to C# , you will live that language too  :thumbsup:
inspirational

Offline L_I_S

  • Freestyle Moderator
  • APATW & PMATW
  • ****
  • Posts: 5,118
  • Reputation: 6249
    • View Profile
Re: C++ programming
« Reply #14 on: Mar 16, 2009, 08:36: PM »
C++ is the best/most powerful language , even JAVA is made in C++ . C++ is best for concepts and the most difficult language because it covers almost every part of the programming stuff from gaming to graphics to pure coding . Learn all the concepts in C++ then move to C# , you will love that language too  :thumbsup:
like dan said. have u made anything in C++ that u could share? just post the code in that>
Code: [Select]
http://www.youtube.com/user/LISdafreestyler
-Don't break combos.
-Don't use crossovers to save combos.
-If you're a new freestyler looking to improve, check the stickys in the help and advice section.
-Send me a personal message if you see spam.

Offline Ahmed

  • TATW & LATW
  • ***
  • Posts: 320
  • Reputation: 566
    • View Profile
Re: C++ programming
« Reply #15 on: Mar 17, 2009, 01:56: AM »
I made a bookshop type of program for my 1st term final , which the code is way to big and it involves quite alot things , so check this , my teacher gave me that as a challange , you just type any dd/mm/yyyy and It will tell you what day it was on that date
Code: [Select]
#include <iostream.h>
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int findDay(int date, int month, int year);

int main()
{
int date, month, year;
clrscr();
char dayName[7][10] =
{"Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"};
cout << "\n Enter the date (1-31): ";
cin >> date;
cout << "\n Enter the month (1-12): ";
cin >> month;
if(date<=31 && month==1 || date<=28&& month==2 || date<=31&& month==3 || date<=30&& month==4||date<=31&& month==5||date<=30 && month==6||
date<=31&& month==7 || date<=31 && month==8 || date<=30 && month==9 || date<=31 && month==10 ||date<=30 && month==11 ||date<=31 && month==12)
{
cout << "\n Enter the year (Non-Negative): ";
cin >> year;
}
else {
  cout<<"\n Error ";
  exit(0);
}


int day = findDay(date, month, year);
cout << endl << "The day is  " << dayName[day] << "." << endl;

getch();
return 0;
}


int findDay(int d, int m, int y)
{
    if (m == 1 || m == 2) y -= 1;
    if (m < 3) m += 12;
    return (d + 2*m + (3*(m+1)/5) + y + (y/4) - (y/100) + (y/400) + 2) % 7;
}

and this is a virtual ATM software I made :D
Code: [Select]
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#define db 20000
struct atmp1 {
int fb;
int wa;
char pcode[20];
char n1[20];
char n2[20];
char n3[20];
char r;
};
struct case1 {
char fc1;
char fc1a;
};
struct case2 {
char fc2;
char fc2a;
};
struct case3 {
char fc3;
char fc3a;
};
struct case4 {
char fc4;
char fc4a;
};
struct case5 {
char fc5;
char fc5a;
};
struct case6 {
char fc6;
char fc6a;
};
struct case7 {
char fc7;
char fc7a;
};
void main()
{
atmp1 st;
case1 a;
case2 b;
case3 c;
case4 d;
case5 e;
case6 f;
case7 g;
int op;
clrscr();
cout<<"\n \t Create Account \n";       //default balance 20,000
cout<<"\n Enter Desired Login I.D : ";
cin>>st.n1;
cout<<"\n Enter Desired Pin Code : ";
cin>>st.pcode;
clrscr();
while(1)
{
cout<<"\n \t Welcome to Customer Menu \n ";
cout<<"\n  1 ---- Withdraw Cash \n";
cout<<"\n  2 ---- Cash Transfer \n";        // Main Menu
cout<<"\n  3 ---- Deposit Cash \n";
cout<<"\n  4 ---- Display Balance \n";
cout<<"\n  5 ---- Exit \n ";
cout<<"\n Please Select One Of The Above Options :  ";
cin>>op;
switch(op)
{
case 1:              // Menu of Withdrawl Cash
char op1;
cout<<"\n Select The Mode of Withdrawl Cash As Follows : \n";
cout<<"\n a) Fast Cash \n";
cout<<"\n b) Normal Cash \n";
cout<<"\n  Please Select A mode Of Withdrawl : ";
cin>>op1;
clrscr();
    switch(op1)
{
case 'a':
int m1;
cout<<"\n Fast Cash \n";     // Fast Cash  Menu
cout<<"\n  1 --- 500 \n";
cout<<"\n  2 --- 1000 \n";
cout<<"\n  3 --- 2000 \n";    //Options of Fast Cash
cout<<"\n  4 --- 5000 \n";
cout<<"\n  5 --- 10000 \n";
cout<<"\n  6 --- 15000 \n";
cout<<"\n  7 --- 20000 \n";
cout<<"\n Select One Of The Denomiations of Money : ";
cin>>m1;
switch(m1)
{
case 1:
cout<<"\n Do You Really Want To Draw 500  [Y/N] ? ";
cin>>a.fc1;
if(a.fc1=='Y' || a.fc1=='y')
{
cout<<"\n Draw Successful \n";
cout<<"\n Do You Want To Print A Receipt [Y/N] ? ";
cin>>a.fc1a;
if(a.fc1a=='Y' || a.fc1a=='y')
       { cout<<"\n  Accout Name : "<<st.n1<<"\n";
cout<<"\n  Withdrawn : 500 "<<"\n";
st.fb=db-500;
cout<<"\n New Balance : "<<st.fb<<"\n"; }
if(a.fc1a=='N'|| a.fc1a=='n')
{cout<<"\n Press Any Key To Continue ";
break;} }
      if(a.fc1=='N'|| a.fc1=='n')
{cout<<"\n Press Any Key To Continue ";
break;}

break;

case 2:
cout<<"\n Do You Really Want To Draw 1000 rs [Y/N] ? ";
cin>>b.fc2;
if(b.fc2=='Y'|| b.fc2=='y')
{
cout<<"\n Draw Successful ";
cout<<"\n Do You Want To Print A Receipt [Y/N] ? ";
cin>>b.fc2a;
if(b.fc2a=='Y'|| b.fc2a=='y')
{cout<<"\n Accout Name : "<<st.n1<<"\n";
  cout<<"\n Withdrawn : 1000 \n";
  st.fb=db-1000;
  cout<<"\n New Balance : "<<st.fb<<"\n";
  }
  if(b.fc2a=='N'|| b.fc2a=='n')
  {cout<<"\n Press Any Key To Continue \n";
   break;} }
if(b.fc2=='N'|| b.fc2=='n')
{cout<<"\n Press Any Key To Continue \n";
break;}


break;

case 3:
cout<<"\n Do You Really Want To Draw 2000 rs [Y/N] ? ";
cin>>c.fc3;
if(c.fc3=='Y'|| c.fc3=='y')
{
cout<<"\n Draw Successful \n";
cout<<"\n Do You Want To Print A Receipt [Y/N] ? ";
cin>>c.fc3a;
if(c.fc3a=='Y'|| c.fc3a=='y')
{cout<<"\n Accout Name : "<<st.n1<<"\n";
  cout<<"\n Withdrawn : 2000 \n";
  st.fb=db-2000;
  cout<<"\n New Balance : "<<st.fb<<"\n";
  }
  if(c.fc3a=='N'|| c.fc3a=='n')
  {cout<<"\n Press Any Key To Continue ";
   break;} }
if(c.fc3=='N'|| c.fc3=='n')
{cout<<"\n Press Any Key To Continue ";
break;}
break;

case 4:
cout<<"\n Do You Really Want To Draw 5000 rs [Y/N] ? ";
cin>>d.fc4;
if(d.fc4=='Y'|| d.fc4=='y')
{
cout<<"\n Draw Successful \n";
cout<<"\n Do You Want To Print A Receipt [Y/N] ? ";
cin>>d.fc4a;
if(d.fc4a=='Y'|| d.fc4a=='y')
{cout<<"\n Accout Name : "<<st.n1<<"\n";
  cout<<"\n Withdrawn : 5000 \n";
  st.fb=db-5000;
  cout<<"\n New Balance : "<<st.fb<<"\n";
  }
  if(d.fc4a=='N'|| d.fc4a=='n')
  {cout<<"\n Press Any Key To Continue ";
   break;} }
if(d.fc4=='N'|| d.fc4=='n')
{cout<<"\n Press Any Key To Continue ";
break;}
break;

case 5:
cout<<"\n Do You Really Want To Draw 10000 rs [Y/N] ? ";
cin>>e.fc5;
if(e.fc5=='Y'|| e.fc5=='y')
{
cout<<"\n Draw Successful \n";
cout<<"\n Do You Want To Print A Receipt [Y/N] ? ";
cin>>e.fc5a;
if(e.fc5a=='Y'|| e.fc5a=='y')
{cout<<"\n Accout Name : "<<st.n1<<"\n";
  cout<<"\n Withdrawn : 5000 \n";
  st.fb=db-10000;
  cout<<"\n New Balance : "<<st.fb<<"\n";
  }
  if(e.fc5a=='N'|| e.fc5a=='n')
  {cout<<"\n Press Any Key To Continue ";
   break;} }
if(e.fc5=='N'|| e.fc5=='n')
{cout<<"\n Press Any Key To Continue ";
break;}
break;

case 6:
cout<<"\n Do You Really Want To Draw 15000 rs [Y/N] ? ";
cin>>f.fc6;
if(f.fc6=='Y'|| f.fc6=='y')
{
cout<<"\n Draw Successful \n";
cout<<"\n Do You Want To Print A Receipt [Y/N] ? ";
cin>>f.fc6a;
if(f.fc6a=='Y'|| f.fc6a=='y')
{cout<<"\n Accout Name : "<<st.n1<<"\n";
  cout<<"\n Withdrawn : 15000 \n";
  st.fb=db-15000;
  cout<<"\n New Balance : "<<st.fb<<"\n";
  }
  if(f.fc6a=='N'|| f.fc6a=='n')
  {cout<<"\n Press Any Key To Continue ";
   break;} }
if(f.fc6=='N'|| f.fc6=='n')
{cout<<"\n Press Any Key To Continue ";
break;}
break;

case 7:
cout<<"\n Do You Really Want To Draw 20000 rs [Y/N] ? ";
cin>>g.fc7;
if(g.fc7=='Y'|| g.fc7=='y')
{
cout<<"\n Draw Successful \n";
cout<<"\n Do You Want To Print A Receipt [Y/N] ? ";
cin>>g.fc7a;
if(g.fc7a=='Y'|| g.fc7a=='y')
{cout<<"\n Accout Name : "<<st.n1<<"\n";
  cout<<"\n Withdrawn : 20000 \n";
  st.fb=db-20000;
  cout<<"\n New Balance : "<<st.fb<<"\n";
  }
  if(g.fc7a=='N'|| g.fc7a=='n')
  {cout<<"\n Press Any Key To Continue ";
   break;} }
if(g.fc7=='N'|| g.fc7=='n')
{cout<<"\n Press Any Key To Continue ";
break;}
break;

default:
cout<<"\n Invalid Option ";
}
break;

case 'b':
char a,a1;
  //     int fb,wa;                       //Normal Cash  Menu
cout<<"\n\t Normal Cash \n";
cout<<"\n Enter The Withdrawl Amount : ";
cin>>st.wa;
if(st.wa>db)
{
cout<<"\n Not Enough Balance In Account ";
break;}
cout<<"\n Do You Really Want to Draw : "<<st.wa<<" [Y/N] ?";
cin>>a;
if(a=='Y')
       {cout<<"\n Successfully Drawn \n ";
cout<<"\n Do You Want To Print A Receipt [Y/N] ? ";
cin>>a1;}
if(a=='N')
{cout<<"\n Press Any Key To Continue ";
break; }

if(a1=='Y')
{
cout<<"\n Account Name : "<<st.n1<<"\n";
st.fb=db-st.wa;
cout<<"\n Withdrawn : "<<st.wa<<"\n";
cout<<"\n New Balance : "<<st.fb<<"\n";
}
if(a1=='N')
{
cout<<"\n Press Any Key To Continue ";
break;
}
break ;


}
break;
    case 2:
    int ct,ac33,ac22;
    char r;
    cout<<"\n \t Cash Transfer \n";  //Cash Transfer  Menu
    cout<<"\n Enter Amout In Multiples of 500  : "; //amount to be transferred
    cin>>ct;
    if(ct%500!=0)
{
cout<<"\n Invalid Amount \n";
break;}
    else
    cout<<"\n Enter Account In Which You Want To Transfer : ";
    cin>>ac33;
    cout<<"\n Are You Sure You Want To Transfer "<<ct<<" To Account"<<ac33<<" If Yes Please Enter Account Name Again : ";
    cin>>ac22;
    cout<<"\n Transaction Confirmed \n";
    cout<<"\n Do You Want To Print Receipt [Y/N] ? ";
    cin>>r;
if(r=='Y' || r=='y')
{cout<<"\n Accout Name : "<<st.n1<<"\n";
cout<<"\n Transaction Made : "<<ct<<"\n";
st.fb=db-ct;
cout<<"\n New Balance : "<<st.fb<<"\n";}
  else if(r=='N' || r=='n')
{cout<<"\n Press Any Key To Continue ";
break;}
    break;

    case 3:
    int cd;
    char rcd1;                      // Depost Cash Menu
    cout<<"\n\t Deposit Cash \n";
    cout<<"\n Enter The Cash Amout To Deposit : ";
    cin>>cd;
    cout<<"\n Cash Deposited Successfully \n";
    cout<<"\n Do You Want To Print The Receipt [Y/N] ? ";
    cin>>rcd1;
if(rcd1=='Y' || rcd1=='y')
{cout<<"\n Account Name : "<<st.n1<<"\n";
cout<<"\n Deposited Money : "<<cd<<"\n";
st.fb=db+cd;
cout<<"\n New Balance : "<<st.fb<<"\n"; }
    else if(rcd1=='N' || rcd1=='n')
{cout<<"\n Press Any Key To Continue ";
break;}
    break ;

    case 4:
    cout<<"\n Your Balance : "<<st.fb;
    break;

    case 5:
    exit(0);
    break;

    default:
    cout<<"\n Invalid Option ";

}
cout<<"\n Do You Wish To See The Menu Again [Y/N] ? ";
cin>>st.r;
if(st.r=='Y' || st.r=='y')
continue;
else if(st.r=='N' || st.r=='n')
exit(0);
}

}

Offline L_I_S

  • Freestyle Moderator
  • APATW & PMATW
  • ****
  • Posts: 5,118
  • Reputation: 6249
    • View Profile
Re: C++ programming
« Reply #16 on: Mar 17, 2009, 12:38: PM »
nice atm thingo, looks hard to make.
wen i compiled it, it gave me a few errors so i had to change a few things like

Code: [Select]
[b]#include <iostream>[/b]
#include <conio.h>
#include <stdlib.h>
[b]using namespace std;[/b]
#define db 20000
[b]
void clrscr()
{
}[/b]

i had to add those in for some reason :S
http://www.youtube.com/user/LISdafreestyler
-Don't break combos.
-Don't use crossovers to save combos.
-If you're a new freestyler looking to improve, check the stickys in the help and advice section.
-Send me a personal message if you see spam.

Offline Ahmed

  • TATW & LATW
  • ***
  • Posts: 320
  • Reputation: 566
    • View Profile
Re: C++ programming
« Reply #17 on: Mar 17, 2009, 03:08: PM »
which program and which compiler are you using? those two are made in Turbo C++

Offline L_I_S

  • Freestyle Moderator
  • APATW & PMATW
  • ****
  • Posts: 5,118
  • Reputation: 6249
    • View Profile
Re: C++ programming
« Reply #18 on: Mar 17, 2009, 03:25: PM »
visual studio 2008 and its compiler.
http://www.youtube.com/user/LISdafreestyler
-Don't break combos.
-Don't use crossovers to save combos.
-If you're a new freestyler looking to improve, check the stickys in the help and advice section.
-Send me a personal message if you see spam.

Offline Ahmed

  • TATW & LATW
  • ***
  • Posts: 320
  • Reputation: 566
    • View Profile
Re: C++ programming
« Reply #19 on: Mar 17, 2009, 03:32: PM »
havent used that one , but if you can paste the errors here I then will be able to fix them , and which code are you talking about?

Offline L_I_S

  • Freestyle Moderator
  • APATW & PMATW
  • ****
  • Posts: 5,118
  • Reputation: 6249
    • View Profile
Re: C++ programming
« Reply #20 on: Mar 17, 2009, 03:34: PM »
the ATM 1.

Code: [Select]
1>Embedding manifest...
1>.\Debug\3.exe.intermediate.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified.
1>Build log was saved at "file://c:\Documents and Settings\mel100981\Desktop\3\3\Debug\BuildLog.htm"
1>3 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
http://www.youtube.com/user/LISdafreestyler
-Don't break combos.
-Don't use crossovers to save combos.
-If you're a new freestyler looking to improve, check the stickys in the help and advice section.
-Send me a personal message if you see spam.

Offline L_I_S

  • Freestyle Moderator
  • APATW & PMATW
  • ****
  • Posts: 5,118
  • Reputation: 6249
    • View Profile
Re: C++ programming
« Reply #21 on: Mar 17, 2009, 03:38: PM »
maybe something to do with wen u copy paste ur code the " character changes into the ' character?
http://www.youtube.com/user/LISdafreestyler
-Don't break combos.
-Don't use crossovers to save combos.
-If you're a new freestyler looking to improve, check the stickys in the help and advice section.
-Send me a personal message if you see spam.

Offline Ahmed

  • TATW & LATW
  • ***
  • Posts: 320
  • Reputation: 566
    • View Profile
Re: C++ programming
« Reply #22 on: Mar 17, 2009, 06:38: PM »
the problem is of syntax , cause there is a little bit difference in the compiler , Turbo C++ is very very old and Visual studio 2008 is the latest so download TurboC++ 3.0 and try it in that    :nopity:

Offline L_I_S

  • Freestyle Moderator
  • APATW & PMATW
  • ****
  • Posts: 5,118
  • Reputation: 6249
    • View Profile
Re: C++ programming
« Reply #23 on: Mar 17, 2009, 07:43: PM »
the problem is of syntax , cause there is a little bit difference in the compiler , Turbo C++ is very very old and Visual studio 2008 is the latest so download TurboC++ 3.0 and try it in that    :nopity:
oh i see. its ok, i just modified it and it works perfectly. nice job :thumbsup:
http://www.youtube.com/user/LISdafreestyler
-Don't break combos.
-Don't use crossovers to save combos.
-If you're a new freestyler looking to improve, check the stickys in the help and advice section.
-Send me a personal message if you see spam.