You can only input up to 10 letters.
What do you mean by letters to numbers?
like S, would be 5?
be more specific.
What u mean like in java it.
Int g;
G = 6;
Then ya and so on
;)
#include<iostream>
using namespace std;
void main()
{
int num[10];
char letr[10];
cout<<"please insert 10 letters : "<<endl;
for(int i = 0; i<10; i++)
cin>>letr[i];
num[i]=letr[i];
}
cout<<"\n\n\nthe equivalent numbers for the letters are :\n\n\n";
cout<<letr[i]<<" => "<<num[i]<<endl;
There are some function you may check in the "cstdlib" header (or "stdlib.h"). http://www.cplusplus.com/reference/clibrary/cstdli... Check the first block of functions (String conversion:). I recommend using strtol http://www.cplusplus.com/reference/clibrary/cstdli...
include<stdio.h>
#include<conio.h>
void main(void)
char ask[10];
int i;
for(i=0;i<10;i++)
ask[i]=getche();
printf("\n%d\t%c",ask[i],ask[i]);
getch();
Copyright © 2024 QUIZLS.COM - All rights reserved.
Answers & Comments
Verified answer
What do you mean by letters to numbers?
like S, would be 5?
be more specific.
What u mean like in java it.
Int g;
G = 6;
Then ya and so on
;)
#include<iostream>
using namespace std;
void main()
{
int num[10];
char letr[10];
cout<<"please insert 10 letters : "<<endl;
for(int i = 0; i<10; i++)
{
cin>>letr[i];
num[i]=letr[i];
}
cout<<"\n\n\nthe equivalent numbers for the letters are :\n\n\n";
for(int i = 0; i<10; i++)
{
cout<<letr[i]<<" => "<<num[i]<<endl;
}
}
There are some function you may check in the "cstdlib" header (or "stdlib.h"). http://www.cplusplus.com/reference/clibrary/cstdli... Check the first block of functions (String conversion:). I recommend using strtol http://www.cplusplus.com/reference/clibrary/cstdli...
include<stdio.h>
#include<conio.h>
void main(void)
{
char ask[10];
int i;
for(i=0;i<10;i++)
{
ask[i]=getche();
}
for(i=0;i<10;i++)
{
printf("\n%d\t%c",ask[i],ask[i]);
}
getch();
}