0
Please..Can anyone help me to make it C language? I really need this project..Thank you. (the code is in the deacription)
#include <iostream> #include <string> #include <time.h> using namespace std; int main(){ srand(time(NULL)); string one; string name[100]; int count = 0; string again; again = "y"; int num = 0; while(one != "0") { cout<<"Enter name: (0 to stop entering names)"<<endl; cin>> one; if(one == "0") break; name[count] = one; count++; } while(again == "y"){ num = rand()%count; cout<<num; cout<<"Random name chosen was "<<name[num]<<endl; cout<<"Chose again? (y/n)"; cin >> again; } cin.get(); cin.ignore(); }
2 odpowiedzi
+ 1
Conversion needed:
remove using namespace std;
rand() to C version rand
cout to prinf
cin to scanf
iostream to stdio.h
and i think the rest are fine.
#give it a try🙂
0
It works! Thankyou so much