Instructions:
Given code:
#include <iostream>
using namespace std;
int main() {
// NOTE: Do not change this
const char others[100] = "TheQuIckBrownFoxJumpedOvErTheLazyDog";
char myself;
// TODO: Ask the user for the value of `myself`
}
Sample input:
Enter myself: T
26
#include <iostream>
using namespace std;
int main() {
// NOTE: Do not change this
const char others[100] = "TheQuIckBrownFoxJumpedOvErTheLazyDog";
char myself;
// TODO: Ask the user for the value of `myself`
int i=0;
cout<<"Enter char: ";
cin>>myself;
while(others[i]!='\0'){
if(others[i]==myself)
cout<<i<<endl;
i++;
}
}
Comments
Leave a comment