Ok I need to make a 3 part program that made with c++. The first part is to write 10 number, and then program ask to ether repeat the number or to repeat them reverse. Second part I need to make a program that ask for a word and later ask for a letter. Then the program will say that he found the letter to then ask if to tell you the first one or the last one. After you tell him what you want he will tell you the location where he found it. Last part is that he will ask for you to write a word or sentence to later ask you a word to then tell you all the locations that word appears. I started something but my stupid brain won't work so yeah here is what I started:
[#include <iostream>
#include <string>
using namespace std;
string ST1;
int I = 0, Idos, Ans;
int N[11];
int main()
{
cout << "Escribe 10 numeros" << endl ;
for (int I = 1; I <= 10; I++)
{
cout << I << ")"; cin >> N[I]; cout << "\n";
}
cout << "1)Repetirlos en orden O 2) Repetirlos alreves:";
cin >> Ans;
cout << endl;
if (Ans == 1)
{
for (int I = 1; I <= 10;I++ )
{
cout << I << ")" << N[I] << "\n" << endl;
}
}
if (Ans == 2)
{
for (int I = 10; I >= 0; I--)
{
cout << I << ")" << N[I] << "\n" << endl;
}
}
system("pause");
}]
Ok I just got tree information and one got piss of at me cause I was out so yeah sorry well my actual homework is to identify or decipher a already made program I can send a link to a google drive folder to share this program.
your 3 programs are similar in that each takes in 10 objects of a given data-type (for number use int or double, for word use char or string (latter is better) and for word/sentence only use string
next think of a container to store the 10 objects - here again you have various choices like C-style arrays, etc but std::vector<T> is preferred where T is the type of the object stored in the vector
string and vector are preferred as they offer easy access to using standard library functionalities iterators and algorithms
then for the other tasks, I'll mention some functions/methods - google these and try to fit them to your needs, if not successful come back here:
- to repeat the number (which I'm translating as to 'print the numbers' seeing your code) - search 'print vector with range loops c++'
- to repeat/print them reverse, google 'using vector reverse iterators for printing'
- to find locations google, well, 'std::find C++'
- to repeat the number (which I'm translating as to 'print the numbers' seeing your code) - search 'print vector with range loops c++'
- to repeat/print them reverse, google 'using vector reverse iterators for printing'
- to find locations google, well, 'std::find C++'
Keep in mind, this is the OP's homework. It is highly likely he/she can only write code with what they learned so far (though posting answers with this restraint is often cumbersome).
boost you've been giving lots of unsolicited, irrelevant advice lately and quite frankly I'm getting a bit tired of it. if you have anything useful to add just address the OP directly, OK?
Ok I just got tree information and one got piss of at me cause I was out so yeah sorry well my actual homework is to identify or decipher a already made program I can send a link to a google drive folder to share this program.
For what I know it uses strings, arrays, loops and probably some int. But I do not know i just woke up. so I'm not thinking well any ways hers a link for the program:
@gunnerfunner I'm sorry, I didn't realize I was coming off that way. I can understand looking back at my posts now. I will do my best to not be irritating.
@boost lexical cast
if you gonna help then the help me from 6 to 9 cause Mm trying my best to the 3 to 5 and I think I have something but Im running out of time.
Well informing while looking around the internet I found some stuff that are helping me do 3 to 5 that mention @boost lexical cast.
Here is a small update.
#include <iostream>
#include <string>
using namespace std;
string Wordl,New_word, Letter1;
int OPT1, E;
int main()
{
cout << "Escribe lo que quieras:";
cin >> Wordl; cout << endl;