User
Pass
2FA
 
 

Meniu C++
Go to page 1, 2  Next    
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database
Author Message12346
mitzu

[Freakazoid]



Status: Offline
(since 05-11-2015 23:41)
Joined: 19 Dec 2010
Posts: 2424, Topics: 431
Location: Bucuresti

Reputation: 376.9
Votes: 42

   
Post Posted: 27-04-2012, 23:12:31 | Translate post to: ... (Click for more languages)

Ma intrebam ...

Sa zicem ca am un programel .exe facut un C++.

Acest program are un meniu :

Scriu 1, apas enter face ceva, scriu 2 apas enter face ceva, etc

este posibil sa fac un link in powerpoint sa zicem , sa ma duca in executabil direct in unul dintre meniuri ?

Hyperlink stiu sa fac dar banuiesc ca exista un cod ceva care pus dupa acel link sa'l execute cand intra in program ?





Ma gandeam la cum erau unele jocuri cum ar fi Return to Castle Wolfenstein unde ca sa activezi codurile trebuia sa pui ceva la PATH din proprietati.

0 0
  
Back to top
View user's profile Send private message
nr913
[Banned user]


Banned


Status: Offline
(since 24-10-2013 10:06)
Joined: 24 Apr 2009
Posts: 4224, Topics: 223
Location: România

Reputation: 60.3
Votes: 156

 
Post Posted: 28-04-2012, 02:53:15 | Translate post to: ... (Click for more languages)

în funcția main, ai așa:
Code:
int main(int argc, char *argv[]) {
...
}

argc este numãrul de parametri ai programului plus unu.
argv e un vector de parametri ai programului, primul fiind chiar programul (numele fișierului).
So, dacã deschizi programul din CMD așa:
Code:
C:\calea-catre-program\program.exe parametru mai șucar

atunci:
argc = 4
argv[0] = "C:\calea-catre-program\program.exe"
argv[1] = "parametru"
argv[2] = "mai"
argv[3] = "șucar"

Bãnuiesc cã în PowerPoint poți face un link cãtre un program cu parametri.


Attitude - A little thing that makes a BIG difference
0 0
  
Back to top
View user's profile Send private message
mitzu

[Freakazoid]



Status: Offline
(since 05-11-2015 23:41)
Joined: 19 Dec 2010
Posts: 2424, Topics: 431
Location: Bucuresti

Reputation: 376.9
Votes: 42

   
Post Posted: 28-04-2012, 09:26:05 | Translate post to: ... (Click for more languages)

Am incercat, nu reusesc -

main-ul arata cam asa

Code:
int main()
{int i=1;
   prima();
   while(i!=0)
   { if(i==9) prima();
     cin>>i;
     if(i==1) meniu1();
     if(i==2) meniu2();
     if(i==3) meniu3();
     if(i==4) meniu4();
     if(i==5) meniu5();
     if(i==8) despre();
   }      
   if(i==0) iesire();

}


fiecare meniu are un subprogram



-
-
-
-> Visit my GSM store <-

0 0
  
Back to top
View user's profile Send private message
nr913
[Banned user]


Banned


Status: Offline
(since 24-10-2013 10:06)
Joined: 24 Apr 2009
Posts: 4224, Topics: 223
Location: România

Reputation: 60.3
Votes: 156

 
Post Posted: 28-04-2012, 21:56:37 | Translate post to: ... (Click for more languages)

Code:
int main(int argc, char *argv[])
{int i=1;
   if (argc > 1)
      i = atoi(argv[1], 10);
   else
      prima();
   while(i!=0)
   { if(i==9) prima();
     cin>>i;
     if(i==1) meniu1();
     if(i==2) meniu2();
     if(i==3) meniu3();
     if(i==4) meniu4();
     if(i==5) meniu5();
     if(i==8) despre();
   }      
   if(i==0) iesire();

}


Attitude - A little thing that makes a BIG difference
0 0
  
Back to top
View user's profile Send private message
mitzu

[Freakazoid]



Status: Offline
(since 05-11-2015 23:41)
Joined: 19 Dec 2010
Posts: 2424, Topics: 431
Location: Bucuresti

Reputation: 376.9
Votes: 42

   
Post Posted: 30-04-2012, 00:10:45 | Translate post to: ... (Click for more languages)

Nu reusesc, la 'atoi' de ce ai pus ',10' ?

atoi are un singur argument Thinking



-
-
-
-> Visit my GSM store <-

0 0
  
Back to top
View user's profile Send private message
nr913
[Banned user]


Banned


Status: Offline
(since 24-10-2013 10:06)
Joined: 24 Apr 2009
Posts: 4224, Topics: 223
Location: România

Reputation: 60.3
Votes: 156

 
Post Posted: 30-04-2012, 11:47:06 | Translate post to: ... (Click for more languages)

Am încurcat cu itoa care al doilea parametru este baza. Ce anume nu reușești?

Attitude - A little thing that makes a BIG difference
0 0
  
Back to top
View user's profile Send private message
mitzu

[Freakazoid]



Status: Offline
(since 05-11-2015 23:41)
Joined: 19 Dec 2010
Posts: 2424, Topics: 431
Location: Bucuresti

Reputation: 376.9
Votes: 42

   
Post Posted: 30-04-2012, 22:43:28 | Translate post to: ... (Click for more languages)

Am sters acel 10.

Cand pun in cmd "D:\Atestat.exe" o ia

cand pun parametrul meniului, se blocheaza

Cum ar trebui sa arate comanda mai exact ?

nu : "D:\Atestat.exe 1" fara ghilimele ?



-
-
-
-> Visit my GSM store <-

0 0
  
Back to top
View user's profile Send private message
nr913
[Banned user]


Banned


Status: Offline
(since 24-10-2013 10:06)
Joined: 24 Apr 2009
Posts: 4224, Topics: 223
Location: România

Reputation: 60.3
Votes: 156

 
Post Posted: 01-05-2012, 12:19:06 | Translate post to: ... (Click for more languages)

"D:\Atestat.exe" 1

Attitude - A little thing that makes a BIG difference
0 0
  
Back to top
View user's profile Send private message
mitzu

[Freakazoid]



Status: Offline
(since 05-11-2015 23:41)
Joined: 19 Dec 2010
Posts: 2424, Topics: 431
Location: Bucuresti

Reputation: 376.9
Votes: 42

   
Post Posted: 01-05-2012, 12:30:28 | Translate post to: ... (Click for more languages)

nu reactioneaza la "D:\Atestat.exe" 1

ma dau batut Dosent Matter

multumesc oricum



-
-
-
-> Visit my GSM store <-

0 0
  
Back to top
View user's profile Send private message
nr913
[Banned user]


Banned


Status: Offline
(since 24-10-2013 10:06)
Joined: 24 Apr 2009
Posts: 4224, Topics: 223
Location: România

Reputation: 60.3
Votes: 156

 
Post Posted: 01-05-2012, 13:52:33 | Translate post to: ... (Click for more languages)

Ia scrie aici tot programul tãu.

Attitude - A little thing that makes a BIG difference
0 0
  
Back to top
View user's profile Send private message
mitzu

[Freakazoid]



Status: Offline
(since 05-11-2015 23:41)
Joined: 19 Dec 2010
Posts: 2424, Topics: 431
Location: Bucuresti

Reputation: 376.9
Votes: 42

   
Post Posted: 01-05-2012, 19:17:19 | Translate post to: ... (Click for more languages)

WALL OF TEXT

Code:

#include<iostream>
#include<stdlib.h>
#include<iomanip>
#include<time.h>
#include<stdio.h>
using namespace std;



int prima()
{system("color 0b");
   system("cls");
   cout<<endl<<endl<<endl;
   cout<<"            Program educativ pentru invatarea tablei inmultirii                 "<<endl;
   cout<<"________________________________________________________________________________"<<endl<<endl;
   cout<<"  Introduceti cifra corespunzatoare optiunii dorite:                            "<<endl<<endl;
   cout<<"     1) Ce este inmultirea?"<<endl;
   cout<<"     2) Proprietatile inmultirii"<<endl;
   cout<<"     3) Invata Tabla inmultirii"<<endl;
   cout<<"     4) Exerseaza Tabla inmultirii v1"<<endl;
   cout<<"     5) Exerseaza Tabla inmultirii v2"<<endl<<endl<<endl;
   cout<<"     8) Despre program"<<endl<<endl;
   cout<<"     0) Iesire"<<endl<<endl<<endl;
   cout<<"Optiunea: ";
   return 1;
}

int despre()
{system("color 0f");
   system("cls");
   cout<<endl<<endl<<endl<<endl<<endl;
   cout<<"                              > Bine ati venit! <                              "<<endl<<endl<<endl;
   cout<<"_______________________________________________________________________________"<<endl;
   cout<<"|                                                                             |"<<endl;
   cout<<"|      Acest program a fost destinat copiilor cu varste cuprinse intre        |"<<endl;
   cout<<"|5 si 10 ani care doresc sa invete cu usurinta tabla inmultirii.Softul contine|"<<endl;
   cout<<"|  atat un meniu de invatare a tablei cat si 2 modele de teste interactive.   |"<<endl;
   cout<<"|                                                                             |"<<endl;   
   cout<<"|_____________________________________________________________________________|"<<endl<<endl;
   cout<<"                      .-~~~~~~~~~-._       _.-~~~~~~~~~-.                      "<<endl;
   cout<<"                  __.'              ~.   .~              `.__                  "<<endl;
   cout<<"                .'//                  } {                  \\`.                "<<endl;
   cout<<"              .'//                     |                     \\`.              "<<endl;
   cout<<"            .'// .-~-------~~~~-._     |     _,-~~~~-------~-. \\`.            "<<endl;
   cout<<"          .'//.-                  `-.  |  .-                   -.\\`.          "<<endl;
    cout<<"        .'//______.============-..   ) | (   ..-============.______\\`.        "<<endl;
   cout<<"      .'______________________________)|(______________________________`.;     "<<endl<<endl;
   cout<<"9) Meniu anterior                                            0) Iesire program "<<endl<<endl;
   cout<<"Optiunea: ";
   return 1;
}

int meniu1()
{system("color 0e");
   system("cls");
   cout<<endl<<endl<<endl<<endl;
   cout<<"                          >  Ce este inmultirea?  <                           "<<endl<<endl<<endl;
   cout<<"_______________________________________________________________________________"<<endl;
   cout<<"|              Inmultirea este o operatie matematica ce poate                 |"<<endl;
   cout<<"|                    fi definita ca o adunare succesiva.                      |"<<endl;
   cout<<"|                                                                             |"<<endl;
   cout<<"|                                                                             |"<<endl;
   cout<<"|  De exemplu: 3*4=3+3+3+3=12.  -Se poate spune si 'aduna 3 de 4 ori'-        |"<<endl;
   cout<<"|_____________________________________________________________________________|"<<endl<<endl;
   cout<<"9) Meniu anterior                                            0) Iesire program "<<endl<<endl;
   cout<<"Optiunea: ";
   return 1;
}

int meniu2()
{system("color 0e");
   system("cls");
   cout<<endl;
   cout<<"                  >  Care sunt proprietatile inmultirii?  <                    "<<endl<<endl;
   cout<<"_______________________________________________________________________________"<<endl;
   cout<<"|  1) Comutativitatea                                                         |"<<endl;
   cout<<"|         Acest lucru inseamna ca ordinea factorilor nu conteaza              |"<<endl;
   cout<<"|              Ex: A*B=B*A ( 3*2=2*3=6 )                                      |"<<endl;
   cout<<"|                                                                             |"<<endl;
   cout<<"|  2) Asociativitatea                                                         |"<<endl;   
   cout<<"|         Acest lucru inseamna ca nu conteaza ordinea operatiilor             |"<<endl;
   cout<<"|         (cand este prezenta o inmultire de cel putin 3 factori)             |"<<endl;
   cout<<"|              Ex: (A*B)*C=A*(B*C) ( (2*3)*4=2*(3*4)=24 )                     |"<<endl;
   cout<<"|                                                                             |"<<endl;
   cout<<"|  3) Elementul neutru                                                        |"<<endl;
   cout<<"|         Acest lucru inseamna ca exista un numar (1) care indeplineste:      |"<<endl;
   cout<<"|              Ex: 1*A=A*1=A ( 1*3=3*1=3 )                                    |"<<endl;
   cout<<"|                                                                             |"<<endl;
   cout<<"|  4) Orice numar inmultit cu 0 este tot 0.                                   |"<<endl;
   cout<<"|_____________________________________________________________________________|"<<endl<<endl;
   cout<<"9) Meniu anterior                                            0) Iesire program "<<endl<<endl;
   cout<<"Optiunea: ";
   return 1;
}

int meniu3()
{int n,j;
system("color 0a");
   system("cls");
   cout<<endl;
   cout<<"                              Tabla inmultirii                                 "<<endl;
   cout<<"_______________________________________________________________________________"<<endl<<endl;
   cout<<"  Introduceti numarul pentru care doriti sa afisati tabla inmultirii           "<<endl;
   cout<<"        (se va afisa tabla inmultirii cu numarul dvs. de la 1 la 10)           "<<endl<<endl;
   cout<<" Numarul este: ";
   cin>>n;
   while(n>10)
   {cout<<endl<<endl;
    cout<<"     AVERTIZARE!! Numarul introdus a fost mai mare decat 10. "<<endl<<endl;
    cout<<" Numarul este: "; cin>>n;
   }
   system("cls");
   cout<<endl;
   cout<<"                              Tabla inmultirii                                 "<<endl;
   cout<<"_______________________________________________________________________________"<<endl<<endl;
   cout<<"  Se afiseaza tabla inmultirii de la 1 la 10 cu numarul "<<n<<"                "<<endl<<endl;
   cout<<"     _____________________"<<endl;
   for(j=1;j<=10;j++)
   cout<<"     | "<<setw(3)<<n<<" * "<<setw(3)<<j<<" = "<<setw(3)<<j*n<<"   |"<<endl;
   cout<<"     |___________________|"<<endl<<endl;
   cout<<"9) Meniu anterior          3)Introduceti alt numar           0) Iesire program "<<endl<<endl;
   cout<<"Optiunea: ";
   return 1;
}

int meniu4()
{int n,j,z=0,r[11],a,v[11]={1,1,1,1,1,1,1,1,1,1,1};
system("color 0f");
   system("cls");
   cout<<"                          Exersati Tabla inmultirii v1                         "<<endl;
   cout<<"_______________________________________________________________________________"<<endl<<endl;
   cout<<"  Introduceti numarul pentru care doriti sa exersati tabla inmultirii          "<<endl;   
   cout<<"     (se va executa un test cu numarul dvs. avand la baza tabla inmultirii)    "<<endl<<endl;
   cout<<" Numarul este: ";
   cin>>n;
   while(n>10)
   {cout<<endl<<endl;
    cout<<"     AVERTIZARE!! Numarul introdus a fost mai mare decat 10. "<<endl<<endl;
    cout<<" Numarul este: "; cin>>n;
   }
   system("cls");
   cout<<endl;
   cout<<"                          Exersati Tabla inmultirii v1                         "<<endl;
   cout<<"_______________________________________________________________________________"<<endl<<endl;
   cout<<"  Se testeaza cunostiintele inmultirii de la 1 la 10 cu numarul "<<n<<"        "<<endl<<endl;
   cout<<"     _____________________"<<endl;
   for(a=1;a<=10;a++)
   {j=rand()%10+1;
    while(v[j]==0)
      j=rand()%10+1;
    v[j]=0;
    cout<<"       "<<setw(3)<<n<<" * "<<setw(3)<<j<<"  =  "; cin>>r[j];
   }
   system("cls");
   cout<<endl;
   cout<<"                          Exersati Tabla inmultirii v1                         "<<endl;
   cout<<"_______________________________________________________________________________"<<endl<<endl;
   cout<<"  Se afiseaza rezultatele testului cu numarul "<<n<<"                          "<<endl<<endl;
   cout<<"     _________________________________________________"<<endl;
   for(j=1;j<=10;j++)
   {cout<<"       "<<setw(3)<<n<<" * "<<setw(3)<<j<<" = "<<setw(3)<<r[j]; if(r[j]==j*n) {cout<<" - Corect!"<<endl; z++;} else cout<<" - Incorect! Raspunsul era "<<j*n<<endl;}
   cout<<endl;
   cout<<"Ati punctat un scor de "<<z<<"/10. Acest lucru inseamna "<<z*10<<"% corect"<<endl<<endl;
   cout<<"9) Meniu anterior          4)Introduceti alt numar           0) Iesire program "<<endl<<endl;
   cout<<"Optiunea: ";
   return 1;   
}

int meniu5()
{int n,j,k,z=0,r[11],a,rc[11],c1[11],c2[11];
system("color 0f");
   srand(time(NULL));
   system("cls");
   cout<<endl;
   cout<<"                          Exersati Tabla inmultirii v2                         "<<endl;
   cout<<"_______________________________________________________________________________"<<endl<<endl;
   cout<<"  Veti exersa tabla inmultirii pentru mai multe numere aleatorii               "<<endl;   
   cout<<"     (se va executa un test avand la baza tabla inmultirii)                    "<<endl<<endl;
   cout<<"1) Continuare                                                9) Meniu anterior "<<endl<<endl;
   cout<<"Optiunea: ";
   cin>>n;
   while(n>10)
   {cout<<endl<<endl;
    cout<<"     AVERTIZARE!! Numarul introdus a fost mai mare decat 10. "<<endl<<endl;
    cout<<" Numarul este: "; cin>>n;
   }
   if(n==9) {prima(); return 1;}
   system("cls");
   cout<<endl;
   cout<<"                          Exersati Tabla inmultirii v2                         "<<endl;
   cout<<"_______________________________________________________________________________"<<endl<<endl;
   cout<<"  Se testeaza cunostiintele despre tabla inmultirii invatate                   "<<endl<<endl;
   cout<<"     _____________________"<<endl;
   for(a=1;a<=10;a++)
   {j=rand()%11;
    k=rand()%11;
    c1[a]=j;
    c2[a]=k;
    rc[a]=j*k;
    cout<<"       "<<setw(3)<<j<<" * "<<setw(3)<<k<<"  =  "; cin>>r[a];
   }
   system("cls");
   cout<<endl;
   cout<<"                          Exersati Tabla inmultirii v2                         "<<endl;
   cout<<"_______________________________________________________________________________"<<endl<<endl;
   cout<<"  Se afiseaza rezultatele testului cu numarul "<<n<<"                          "<<endl<<endl;
   cout<<"     _________________________________________________"<<endl;
   for(j=1;j<=10;j++)
   {cout<<"       "<<setw(3)<<c1[j]<<" * "<<setw(3)<<c2[j]<<" = "<<setw(3)<<r[j]; if(r[j]==rc[j]) {cout<<" - Corect!"<<endl; z++;} else cout<<" - Incorect! Raspunsul era "<<rc[j]<<endl;}
   cout<<endl;
   cout<<"Ati punctat un scor de "<<z<<"/10. Acest lucru inseamna "<<z*10<<"% corect"<<endl<<endl;
   cout<<"9) Meniu anterior           5) Reluati testul           0) Iesire program "<<endl<<endl;
   cout<<"Optiunea: ";
   return 1;   
}
   
int iesire()
{system("color 0f");
   system("cls");
   cout<<endl<<endl<<endl<<endl<<endl;
   cout<<"_______________________________________________________________________________"<<endl;
   cout<<"|                       ATI ALES SA IESITI DIN PROGRAM                        |"<<endl;
   cout<<"|                                                                             |"<<endl;
   cout<<"|                                                                             |"<<endl;
   cout<<"|  VA MULTUMIM CA ATI ALES SOFTUL NOSTRU EDUCATIONAL                          |"<<endl;
   cout<<"|                                                                             |"<<endl;
   cout<<"|                                                      SUGESTII SI RECLAMATII:|"<<endl;
   cout<<"|                                                              Matei Mihai    |"<<endl;
   cout<<"|                                                        [email protected]|"<<endl;
   cout<<"|_____________________________________________________________________________|"<<endl<<endl<<endl;
   cout<<"                                                      ATESTAT INFORMATICA 2012 ";               
   return 1;
   
}

int main(int argc, char *argv[])
{int i=1;
   if (argc > 1)
      i = atoi(argv[1]);
   else
      prima();
   while(i!=0)
   { if(i==9) prima();
     cin>>i;
     if(i==1) meniu1();
     if(i==2) meniu2();
     if(i==3) meniu3();
     if(i==4) meniu4();
     if(i==5) meniu5();
     if(i==8) despre();
   }       
   if(i==0) iesire();

}



-
-
-
-> Visit my GSM store <-

0 0
  
Back to top
View user's profile Send private message
waCk^

[Creep]



Status: Offline
(since 30-11-2013 20:35)
Joined: 17 Jul 2009
Posts: 830, Topics: 25
Location: Romania

Reputation: 265.7
Votes: 9

 
Post Posted: 01-05-2012, 22:27:01 | Translate post to: ... (Click for more languages)

Am o mica nelamurire, facand abstractie la cerinta topicului tau, de ce n-ai folosit un switch in loc de atatea functii? :-\

Download CS 1.6 NON-STEAM
0 0
  
Back to top
View user's profile Send private message
nr913
[Banned user]


Banned


Status: Offline
(since 24-10-2013 10:06)
Joined: 24 Apr 2009
Posts: 4224, Topics: 223
Location: România

Reputation: 60.3
Votes: 156

 
Post Posted: 01-05-2012, 22:38:26 | Translate post to: ... (Click for more languages)

Ai uitat return 0; la main.

Attitude - A little thing that makes a BIG difference
0 0
  
Back to top
View user's profile Send private message
mitzu

[Freakazoid]



Status: Offline
(since 05-11-2015 23:41)
Joined: 19 Dec 2010
Posts: 2424, Topics: 431
Location: Bucuresti

Reputation: 376.9
Votes: 42

   
Post Posted: 01-05-2012, 22:42:00 | Translate post to: ... (Click for more languages)

@waCk^: am avut niste incercari si am dat fail. oricum m'am prins foarte greu cum sa fac mereu sa imi ceara in ce meniu sa intre -

@nr913: am pus si acel return, acelasi rezultat: nu afiseaza nimic.



-
-
-
-> Visit my GSM store <-

0 0
  
Back to top
View user's profile Send private message
koltzu
[Banned user]


Banned


Status: Offline
(since 24-10-2013 15:18)
Joined: 24 Oct 2006
Posts: 6632, Topics: 170
Location: Romania

Reputation: 847.9
Votes: 94

 
Post Posted: 01-05-2012, 23:08:07 | Translate post to: ... (Click for more languages)

Mie-mi merge si cu sursa aia fara return :/ ce IDE folosesti?
0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database  
Go to page 1, 2  Next    


The time now is 06-05-2024, 12:08:52
Copyright info

Based on phpBB ro/com
B

 
 
 







I forgot my password


This message appears only once, so
like us now until it's too late ! :D
x