Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<ctime>
- #include<conio.h>
- #include<cstdlib>
- #include<vector>
- #include<string>
- using std::string;
- using std::vector;
- using std::cout;
- using std::endl;
- using std::cin;
- void main() {
- int tecla;
- vector<int>teclaRR;
- int sumatoria=0;
- while (true)
- {
- if (kbhit()) {
- tecla = _getch();
- if (tecla != 13) {
- cout << tecla<<":"<<char(tecla) << endl;
- teclaRR.push_back(tecla);
- }
- else{
- sumatoria = 0;
- for (int i = 0; i < teclaRR.size(); i++)
- {
- sumatoria += teclaRR.at(i);
- }
- cout <<"La suma es: "<< sumatoria<<endl;
- teclaRR.clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement