Hi, I just made the most stupid program that converts a string from lower case to upper case.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include<iostream>
usingnamespace std;
int main(){
string texto;
cout << "Este programa realiza el siguiente trabajo:" << endl;
cout << "texto -----> TEXTO" << endl << endl;
cout << "Introduzca su texto: ";
getline(cin, texto);
for (int i = 0; i < texto.size(); i++){
if (texto[i] <= 'z' && texto [i] >= 'a'){
texto[i] -= (int('a') - int ('A'));
}
}
cout << texto << endl;
}
It runs perfectly when I build & run from Code::Blocks, but I was trying to use directly Windows Notepad and compile from cmd:
C:\Users\Marcos\Desktop> cpp -o mayusculas mayusculas.cpp
C:\Users\Marcos\Desktop> mayusculas
Program too big to fit in memory
It´s obviously not a "big program", so what do you think I may have done wrong? I remember doing this in the past, following some video tutorial, and I remember it worked for me.. I just don´t know what could I be doing differently...
> me tira el error "warning: no new line at the end of file" o algo así.
It is good practice to end a text file with a new-line character. As far as c++ is concerned, you can safely ignore this noisy g++ warning.
A source file that is not empty and that does not end in a new-line character, or ... <elided> ..., shall be processed as if an additional new-line character were appended to the file - IS
> ¿Sabés qué diferencia hay entre compilar con c++ y con g++?
c++ or CC is usually a link to the default C++ compiler on the system - what it means would therefore depend on the system.
Linux - c++ => g++
FreeBSD-current- c++ => clang++
etc.
g++ is the driver for GCC used to compile C++ programs; links libstdc++ by default.